0
votes

I am making a hybrid app using Ionic and I try to center my page titles using this:

<ion-view animation="none" hide-back-button="true" align-title="center" view-title="TITLE">

Most of the times when the pages loads, the title is centered, but sometimes the title is positioned to the left, as if it totally ignores the align-title attribute. Sometimes, navigating back and forth makes thiss behaviour appear. As you can see, I use align-title="center", and I use this on all pages.

Also, I was thinking about trying $ionicConfigProvider.navBar.alignTitle('center') which is described on https://codedump.io/share/JpCokgHaEO4/1/force-align-ionic-view-title-to-the-center-using-css and several other pages, but I couldn't find the correct .config.

Anyone know the way around this?

1

1 Answers

0
votes

To set the alignment programatically you can use the config like this

app.run(function($ionicPlatform){
   //run code
})
.config(function($ionicConfigProvider){
   $ionicConfigProvider.navBar.alignTitle('center') ;
})