Bug or Implementation error with ng-if in Ionic?

Asked

Viewed 81 times

0

I created a list where I need to show whether an item has already been read or not, so I check a variable with the ng-if directive. But when the item is opened, and then returns/browses back to the list, there is no change in the list. I noticed that the variable being checked with ng-if is having its value changed, but ng-if does not reevaluate when the view is shown again. ng-if only works when the screen is loaded/reloaded, ie when close and open the app again.

How could you get around this problem?

<ion-item collection-repeat="item in items" 
             ng-click="ctrl.marcaLida(item.id)"                                    
             ui-sref="menu.telaLeitura({idItem:item.id})">

                        <p ng-if="!item.lido_em">o</p>
                        {{item.nome}}

                    </ion-item>
                </ion-list>

I’m using router for navigation.

1 answer

0

Checks whether ng-click="ctrl.marcaLida(item.id)" is changing the status of the item opnde they come, bank, localstorage, etc. Why when vc leaves the screen and back it is running the repeat of the items and it is not marked as read

  • The value is being changed as it is possible to print in the list. It was the first check I did. They come by default null and after an item is opened, it comes with the value 2015-08-19 15:33:20 which is the date and time the item was opened.

  • Sends the controller code to jsfiddle before p puts {{item.lido_em}} and checks what comes back when you change view and when you reload the page

Browser other questions tagged

You are not signed in. Login or sign up in order to post.