Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

SOLVED: How to display an img on ionic2 project

$
0
0

@Darkpio wrote:

i didn't succed to display an image. Someone get the answer?

ionic start myApp sidemenu
ionic platform add android@4.1.1 //API level 22
ionic run android

I add in www/index.html for not having the withelist error in android.:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">

i create a file img in myApp/app/ (as the same level than css, pages, theme folder)

i put inside the img file my picture profil.png

in app/pages/getting-started.html

<ion-navbar *navbar>
  <button menuToggle>
    <ion-icon name="menu"></ion-icon>
  </button>
  <ion-title>Getting Started</ion-title>
</ion-navbar>

<ion-content padding class="getting-started">
  <h3>Getting Started</h3>
  <p>
     Get it started!
  </p>
  <img src="img/profil.png"  />
  <p>
    <button primary menuToggle>Toggle Menu</button>
  </p>
</ion-content>

i tried without succes :
<img src="../Images/profil.png" />
<img src="./Images/profil.png" />
<img src="Images/profil.png" />
<img src="../img/profil.png" />
<img src="./img/profil.png" />
<img src="img/profil.png" />
<img src="profil.png" />

I also copy by hand the file img in www/build

without success:
with chrome://inspect/#devices

Failed to load resource: net::ERR_FILE_NOT_FOUND
profil.png:1 GET file:///android_asset/www/img/profil.png net::ERR_FILE_NOT_FOUND

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>