mateeyow
mateeyow

Reputation: 1356

Cannot view images when viewing ionic app on android phone

When I tried running my app using ionic run --device the images under /www/img does not seem to appear correctly. Here's my current setup

Cordova CLI: 5.0.0 Gulp version: CLI version 3.8.11 Gulp local: Local version 3.8.11 Ionic Version: 1.0.0 Ionic CLI Version: 1.4.5 Ionic App Lib Version: 0.0.22 OS: Distributor ID: elementary OS Description: elementary OS Freya Node Version: v0.12.2

Here's the code snippet:

<ion-view view-title="My Account">
 <ion-content>
    <div class="list card">
        <div class="item item-avatar">
        <img src="/img/profile-img.jpg">
        <h2>Marty McFly</h2>
        <p>[email protected]</p>
        <button class="button button-clear icon ion-android-more-vertical signout" ng-click="openPopover($event)"></button>
      </div>
   </ion-content>

Here's the screenshot: enter image description here

Upvotes: 1

Views: 821

Answers (2)

Pravin Bhudiya
Pravin Bhudiya

Reputation: 1

also found bug . remove "-" from your image name and use path like "img/image.png"

Upvotes: 0

LeftyX
LeftyX

Reputation: 35587

How do you reference your image?

You can do this:

<img ng-src="img/myimage.png" />

or

<img src="img/myimage.png" />

and if the image comes from a model:

<img ng-src="{{image}}" />

or

<img ng-src="{{vm.image}}" />

Upvotes: 1

Related Questions