Dynamically setting title of a nav page


#1

How can I dynamically set the title of a nav page. I would like to set the title using information I have in my controller, but the controller is defined inside the nav page.

Thanks a lot for a great framework.

Kim


#2

Hey Kim,

Why don’t you hang on for just a few hours. I am shipping a new nav system that actually uses the Angular routeProvider instead and has some extra features. It’s a bit more powerful and should be familiar to those with ngRoute experience.

I’ll throw in some tests to make sure the title can be easily bound and updated.


#3

Kim,

Try fetching the Ionic code again and take a look at this example: https://github.com/driftyco/ionic/blob/master/js/ext/angular/test/navAndTabs.html

This is with the new nav system that works using Angular’s $routeProvider.

With this new system, you can supply an expression to the title attribute, like this:

<nav-page title="pet.title" ng-controller="PetCtrl">
</nav-page>

So this will update the title of the page with the value of pet.title.

Does that work better for you?

If you like, you can also take a look at ionic-angular-cordova-seed which is a starter project for using Ionic with AngularJS and Cordova. There are still some bugs I’m working through this week on it, but it works (having some tap issues in phonegap).

Let me know how that works!


#4

Thanks a lot. I´m sorry if I´m to eager testing your new framework;) I´ll try loading the new code and give it a try again.

Keep up your great work.

Kim


#5

No, it’s great :slight_smile: I was just getting rid of that old nav controller and wanted you to use the new one which really is much better!

Looking forward to hearing how it goes.