Issue updating an ion-view title

I kinda know why this is happening but I’m having difficulty actually fixing it. :wink:

I’ve got a view using this:

<ion-view title="{{entry.title}}">

In my controller, I load an entry asynchronously like so:

.controller('EntryCtrl', ['$scope', 'RSSService', '$stateParams', function($scope, RSSService, $stateParams) {

RSSService.getEntry($stateParams.index).then(function(entry) {
	$scope.entry = entry;
}, function(err) {
	console.log("error", err);
});

}]);

I’ve tried $scope.$apply but get the digest already in progress error.

can you create a code pen Raymond. Wan to try one or 2 things

FYI, I see that the attribute is now view-title, but using that didn’t help.

It has a lot of files currently - would you mind a zip?

Ah I ran across this the other day and was going to do some more tests before putting in a PR.
Try using the ionic-title directive instead of the attribute in the view.

Hi todd the attribute has now changed since beta 13 I think to view-title

Yeah, I tried view-title, but it didn’t help.

Yes, I know that there have been changes, but I too was having trouble updating the title. In the end, to get it updating I had to use the title directive (can’t remember the actual name just now) instead of using the attribute in the view directive.

I’m mobile now but can post some code later today if it’s still not clear.

Ok folks, thanks to Todd I checked out ion-nav-title:

<ion-view view-title="{{entry.title}}">
<ion-nav-title>{{entry.title}}</ion-nav-title>

Yes, I know I have the title duplicated there, will fix later. :wink: This works, but the title is horribly cropped:

It is virtually unusable like this. Am I using it wrong?

Ah yes, it’s ion-nav-title. http://ionicframework.com/docs/api/directive/ionNavTitle/
Using this got it working for me.

Ok, looks to be a known bug, https://github.com/driftyco/ionic/issues/2945.

Applying this change It works fine!

Instead of

<ion-view title='{{datos.titulo}}' cache-view="false">

use

<ion-view cache-view="false">
<ion-nav-title>{{datos.titulo}}</ion-nav-title>
</ion-view>
1 Like

For anyone interested I wrote up my findings on this in a quick blog post, including a couple of codepens.

Thanks for taking the time to research and document this.

1 Like