Reputation: 7768
I am trying to change the title of my ionic page dynamically based on a variable as follows,But it is not working,it showing an error.
<ion-view view-title='{{type == "nhs" : "NHS" : "Other"}} Prescription' cache-view="false">
Upvotes: 1
Views: 671
Reputation: 48837
I also had issues with non-hardcoded views titles. The solution I found is to use the ion-nav-title
directive:
<ion-view cache-view="false">
<ion-nav-title ng-bind="{{type == 'nhs' ? 'NHS' : 'Other'}} Prescription"></ion-nav-title>
</ion-view>
Upvotes: 2
Reputation: 2940
it might be because of syntax error .
condition ? expr1 : expr2
try this
<ion-view title={{type == 'nhs' ? 'NHS' : 'Other'}} cache-view="false" >
or use ng-if
condition
Upvotes: 2
Reputation: 2701
<ion-view title="{{(type == 'nhs') ? 'NHS' : 'Other'}} Prescription" cache-view="false">
Upvotes: 1