Ionic Ion-List is Not Updating After Item is Being Added

So if it isn’t obvious - if you just add a button to your view with Add Window and remove the header button, you can fix this right now. I’m going to keep looking though for a way to get that header button working.

Thanks a lot for your hard work in debugging the issue! I would definitely implement your suggestions and update my team on your findings.

So I’d look at ion-nav-bar, http://ionicframework.com/docs/api/directive/ionNavBar/. I haven’t used it in a while, but I believe it lets you set header buttons per view, which would let you specify the button JUST for that view, and it should then automatically be tied to the right scope stuff.

Yep - that worked for me. In your index.html, I removed all the header crap and just did:

  <ion-nav-bar>
  </ion-nav-bar>

Then in the view, I did:

<ion-nav-buttons side="right">
      <button ng-click="modal.show()" class="button">Add New Window</button>

</ion-nav-buttons>

and it seems to work perfectly.

If this works for you, awesome, and consider visiting my Amazon Wish List. (Yes, thats cheesy, but what the heck. :wink:

Thanks! Unfortunately, when I add the ion-nav-bar I don’t see anything in the top bar.

<ion-pane>

  <ion-nav-bar></ion-nav-bar>

  <ion-nav-buttons side="right">
    <button ng-click="modal.show()" class="button">Add New Window</button>
  </ion-nav-buttons>

  <ion-nav-view class="has-header"></ion-nav-view>

</ion-pane>

The nav bar goes in index.html, the buttons in the view.

Thanks! Not working for me and even if it works it does not makes sense why that is tied to the problem I am facing. This is just one problem I encountered during validating Ionic for 1 day I wonder how rocky the road would be if we choose Ionic for creating our big application. Thanks a lot for your help!

“Not working” - it sounds like it is working though?

As I said - I had warned that this could be a mistake on your part. I really think the way you did the top level button was wrong. Can I give you an easy explanation as to why? No - I can’t. When I noticed it, it felt wrong, and it ended up being the issue, but I really think you made a small mistake here and that’s why it failed. I don’t mean to say “You suck” because trust me, I still screw this stuff up, but in my opinion, this isn’t a fault of Ionic, or Angular, just something you tripped into that was a bit difficult to debug. I’m very biased towards Ionic (I’m a fan boy), so I really hope you keep at it.

Can you send or upload the updated code?

The biggest problem I am seeing is that the framework does not alarm you if you are doing anything wrong. No error, no warning nothing… Basically you go on a wild goose chase to fix the issues.

Here ya go:

https://dl.dropboxusercontent.com/u/88185/ICR%202.zip

As to your issue - to be fair - this is a problem in every language and framework out there. Some things lead to errors that can be reported right away. Something leads to unexplained behavior that are not reported, but just happen.

I’ll stop trying to push you on Ionic though and focus on helping you with this. As you can see, I’m fairly biased. :wink:

Also, I don’t understand why the NavBar which opens the modal has to be part of the modal. It should be part of the Index.html page since it is the master page which contains everything.

Oh sorry - no - it is part of the view, not the modal. When I said view, I meant your list of windows.

Once you get the zip you will see.

I looked at the code you provided and with those modifications I see the following error on the console:

Controller ‘ionNavBar’, required by directive ‘ionNavButtons’, can’t be found!

Also, when the modal is displayed the “close” button and “save” button stopped working.

I am going line by line now in your code and in my code to see what is wrong!

Not sure what to say. I just double checked and I had no error in console. I had a F-bomb so I removed that. I made a new zip and re-put it on Dropbox.

Thanks! I closed the browser and the editor and restarted the ionic server and now it is working. Now working on making the back button to show up is another long journey. Thanks for your help!

1 Like

Woot - glad we got this. It was fun. (Well, for me anyway. :wink: