Use image inside view-title

Hi everyone!

I would like to have an image as a title in every page, right now I’m doing something similar to this.

<ion-view view-title="FooBar">

Current solution: I put this code below in every single page (above ion-content and below ion-view

   <img src="..">

I don’t know how to change FooBar to an image. Obviously my app has mutiple pages so my question is… Is there a way to include an image as a title (view-title) to all the pages in my app? (or something similar to this)


<ion-view view-title="<img src='x.jpg'>">

Read the Ionic docs before posting your question :smile:. Your answer is here.

1 Like

Thanks @seanhill

I saw the docs and used the ion-nav-title to put an image on my pages, but in every page I have to put this block of code, I just felt that maybe that’d be a way to use ion-nav-title once but apply to every single page

I don’t even know if it’s possible or not but I didn’t find something specific to this.

If you want the image on every page put the ion-nav-title as a child of ion-nav-bar. It doesn’t have to be placed on each view. See this codepen:

1 Like

I tried something similar but it didn’t work, of course it’s up to me to figure it out. It’s great to know that I don’t have to repeat myself thanks a lot :slight_smile: @brandyshea !

You’re welcome. If you can’t figure out why it isn’t working you should fork the codepen above and add your code so we can try to help. :smile:

1 Like