Ionic - svg does not appear

10,261

Maybe it is because you use the wrong path, remember when you build an app, you have this:

enter image description here

So the path is need to be "./assets/img/myapp.svg" intread "../../assets/img/myapp.svg" , because in a compiled app you are in the root , it's as if you are loading evething in the index.html file, and it's also works in the browser

Share:
10,261
rafaelcb21
Author by

rafaelcb21

Updated on July 28, 2022

Comments

  • rafaelcb21
    rafaelcb21 almost 2 years

    I made the application build of the ionic 2 sidemenu, however the svg appears in the Chrome but svg does not appear in Android after generate the file android-debug.apk:

    enter image description here

    Follow the commands I used:

    npm install -g ionic cordova ionic start myApp --v2 sidemenu ionic platform add android ionic build android

    /myApp/src/pages/page1/page1.html

    <ion-header>
        <ion-navbar>
            <button ion-button menuToggle>
                <ion-icon name="menu"></ion-icon>
            </button>
            <ion-title>Page One</ion-title>
        </ion-navbar>
    </ion-header>
    <ion-content padding>
        <h3>Ionic Menu Starter</h3>
        <img src="../../assets/img/myapp.svg" alt="">
        <p>
            If you get lost, the
            <a href="http://ionicframework.com/docs/v2">docs</a> will show you the way.
        </p>
        <button ion-button secondary menuToggle>Toggle Menu</button>
    </ion-content>
    

    Could you help me solve this problem?