Image on Header Navbar


#1

Hi all,
I have the need to put an image on the ion-navbar item.

To do that I changed the title $scope variable as follow:

$scope.navTitle = '<img class="app-logo" src="img/app-logo.png" />';

This works fine, but I have to put it in each controller. Is there a way to do that in a cleanest way?

Thanks a lot, Davide.


#2

You could create a general abstract state with template :smile:

Take a look at this codpen, the tabs are set in such a general template as I mean:

I stole the codepen from the docs:
http://ionicframework.com/docs/api/directive/ionNavView/

You could just create a general template for you header in a similair way :wink:


#3

If you are using the nightlies (not advising you do necessarily), take a look at ion-nav-title. http://ionicframework.com/docs/nightly/api/directive/ionNavTitle/


#4

No, I’m not, but I can, because the project is still under development.

Now the question is: how can I upgrade?
:smile:

Thanks, Davide.