简体   繁体   中英

When using a header logo in Ionic, the browser tab shows html

I have a logo image in my header using Ionic.

<ion-view title="<img class='title-image-pic' src='./img/MyImg.jpg'>">

It looks great, but the browser tab shows the html element. How do I work around this and have the browser tab display my title instead of:

<img class='title-image-pic' src='./img/MyImg.jpg'>

Thank you for any advice you can give.

You can set your title in index.html :

<html>
  <head>
    <title>My App</title>
    <!-- Other things -->
  </head>
  <!-- Body and stuff -->
</html>

Then you can set the image in your own template, using the ion-nav-title directive:

<ion-nav-view>
  <ion-view>
    <ion-nav-title>
      <img class='title-image-pic' src='./img/MyImg.jpg'>
    </ion-nav-title>
    <ion-content>
      Some super content here!
    </ion-content>
  </ion-view>
</ion-nav-view>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM