Ionic-framework: bug: ion-view and dynamic title

Created on 8 Jun 2015  Â·  17Comments  Â·  Source: ionic-team/ionic-framework

Type: bug

Platform: all

I have a page that I set the title dynamically like the following example

Now when I add a $timeout in my controller, the page title disappears. I know that it eventually works because when I navigate to the next page and come back the page that is brought from the cache contains the correct title.

As a temporary fix I am using the following

Most helpful comment

@paishin I had some problems with the <ion-view view-title="{{ my_title }}"></ion-view> not updating when changing it in the controller so I switched to using:

<ion-view cache-view="false">
    <ion-nav-title> {{ my_title }} </ion-nav-title>
</ion-view>

This responds to changes to $scope.my_title as far as I can see and will update the ion-view title properly. Try it and see if it works for you.

All 17 comments

I do this and it works fine:

$scope.pagetitle = 'Activity Feed';

and in the view do this. Disregard ng-init

<ion-view view-title="{{pagetitle}}" ng-init="init();">

Try putting the code of the controller in a timeout

$timeout(function(){
$scope.pagetitle = 'Activity Feed';
}, 500);

The reason I am facing this is that I am getting the title value from the database which uses promices so the data might not be available at the initial cycle.

Still works for me actually champ. Add a temp title like 'Please wait...'

On the other hand setting a property which should be static (page title) from a database is bad convention unless only part of the page title is dynamic like Welcome: {{promiseData.firstname}}

Hmmm... It doesn't for me. Its strange because the title is there when i
come back to the view, maybe its a cacheing issue or something . Ill see if
i can recreate it in an example.
On 9 Jun 2015 7:08 pm, "sclearion" [email protected] wrote:

Still works for me actually champ. Add a temp title like 'Please wait...'

—
Reply to this email directly or view it on GitHub
https://github.com/driftyco/ionic/issues/3901#issuecomment-110417105.

yeah I bet its the cache. I hate the cache mechanism even though I appreciate what its trying to do

@paishin I had some problems with the <ion-view view-title="{{ my_title }}"></ion-view> not updating when changing it in the controller so I switched to using:

<ion-view cache-view="false">
    <ion-nav-title> {{ my_title }} </ion-nav-title>
</ion-view>

This responds to changes to $scope.my_title as far as I can see and will update the ion-view title properly. Try it and see if it works for you.

Hi all ,

I did it using the resolve inside the state returning the correct tittle of
the page and this is working very well.without any timeou por evalAsync
Em 11/06/2015 07:25, "Daniel Smith" [email protected] escreveu:

@paishin https://github.com/paishin I had some problems with the view-title="{{ my_title }}"> not updating when changing it the
controller so I switched to using:


{{ my_title }}

This responds to changes to $scope.my_title well and will update the view
title properly. Try it and see if it works for you.

—
Reply to this email directly or view it on GitHub
https://github.com/driftyco/ionic/issues/3901#issuecomment-111001593.

Wish we could vote up answers like in StackOverflow. +1 to hydrogennz. Worked like a charm.

@hydrogennz Thanks, it works !

@hydrogennz Thanks, it works !

@hydrogennz Works great! Thank you!

@hydrogennz Thanks, it works !
But i don't understand why issue was closed. Fix bug!

Agree this shouldn't be closed. Still a bug.

        <ion-view cache-view="false" >
            <ion-nav-title> {{ClaimingConfig.Title}} </ion-nav-title>
        </ion-view>

works with dynamic content.

<ion-view view-title="{{Title}}">

does not.

hey wallstudios
this issue have just a small syntax issue
<ion-view view-title="{{Title}}">
Solution:
just remove double quotes.
<ion-view view-title={{Title}}>

@hydrogennz Thanks a lot, it works for me

tested on ionic v1.3 with side menu:

this code work:
<ion-view> <ion-nav-title>{{ pageTitle }}</ion-nav-title>

this code NOT work:
<ion-view view-title={{Title}}>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vswarte picture vswarte  Â·  3Comments

BilelKrichen picture BilelKrichen  Â·  3Comments

Nick-The-Uncharted picture Nick-The-Uncharted  Â·  3Comments

SebastianGiro picture SebastianGiro  Â·  3Comments

alexbainbridge picture alexbainbridge  Â·  3Comments