I'm currently making a hybrid mobile app with ionic and Angularjs, and I'm trying to display images using the img html tag. My page consists of a carousel at the top (which works well, it displays images) and a list with small images. My page controller has:
app.controller('SalleCtrl', function ($scope,$location) { $scope.salle = { "num": "2", "imgR": [ "img/art_affiche_6_thumb-300x300.jpg", "img/art_affiche_6_thumb-300x300.jpg" ], "title": "Salle 2 : Premiรจres peintures", "_audio_guide": [], "_audio_guide_fe": [], "_audio_guide_en": [], "artworks": [ { "img": "img/art_affiche_6_thumb-300x300.jpg", "href": "http://172.16.12.158/wordpress/mcm_oeuvre/oeuvre-14-2/", "title": "Oeuvre 14" }, { "img": "img/art_affiche_9_thumb-300x300.jpg", "href": "http://172.16.12.158/wordpress/mcm_oeuvre/oeuvre-3/", "title": "Oeuvre 3" } ] }; });
And on my html page there is:
<ion-view title="{{salle.title}}"> <ion-nav-buttons side="right"> <button menu-toggle="right" class="button button-icon icon ion-navicon"></button> </ion-nav-buttons> <ion-content class="has-header" id="" > <ul rn-carousel class="image"> <li ng-repeat="image in salle.imgR" style="background-image:url({{ image }});background-color:black;background-repeat:no-repeat;background-position:center center;background-size : contain;"> </li> </ul> <div class="list"> <a ng-repeat="artwork in salle.artworks" class="item item-avatar" href="{{artwork.href}}"> <img ng-src="{{artwork.img}}"> <h2>{{artwork.title}} {{artwork.img}}</h2> </a> </div> </ion-content>
When I display it in a browser, everything works fine. But when I try to work on my smartphone, the carousel is working, it displays images, but images are not displayed in the list, fuzzy {{artwork.img}} show me all the images. I am doing my best:
- replace 'ng-src' with 'src' but nothing happens
- replace ng-src = "{{artwork.img}}" with ng-src = "img / art_affiche_6_thumb-300x300.jpg" it works.
Apparently the binding is wrong ... Do you have an idea why? And how to solve this ?! Moreover, on my smartphone the path to the images looks like this: "cdvfile: // localhost / persistent / ...". The carousel works well, but the list of images does not work, and when I translated "cdvfile: // localhost / persistent / ..." to "file: // mnt / sdcard / ...", it works. Why?