2016-08-29 62 views
0

我使用我的控制器将图像加载到视图中。它的工作原理,但我有以下错误,当我加载视图:在渲染视图之前加载数据

%7B%7Bimage.thumbnail%7D%7D:1 GET http://localhost:9000/%7B%7Bimage.thumbnail%7D%7D 404 (Not Found) 

尽管如此,有错误,它的工作原理,但我试图摆脱它。

下面是我在做什么之前:

控制器:

app.controller("WeddingGalerieCtrl", function($scope, $http) { 

    $http.get(url) 
    .then(function(response){ 
     $scope.images=response.data; 
     console.log($scope.images); 
    }); 

}) 

观点:

<ul class="list" > 
    <li lightgallery class="list-item" ng-repeat="image in images"> 
    <a href="{{image.big}}"> 
     <img class="img-responsive" src="{{image.thumbnail}}" alt="" /> 
    </a> 
    </li> 
</ul> 

我尝试添加一个解析功能,使视图呈现在我的数据将加载,但我仍然有同样的错误。

.when('/gallery/wedding', { 
    templateUrl: 'views/gallery.html', 
    controller: 'WeddingGalerieCtrl', 
    css: ['../styles/galleries.css','../styles/lightgallery.css'], 
    resolve: { 
     images: function($http) { 
      return $http.get(url).then(function(response) { 
       return response.data; 
      }); 
     } 
    } 
    }) 

app.controller("WeddingGalerieCtrl", function($scope, $http, images) { 
    $scope.images = images; 
}) 

回答

0

愚蠢的我,我只注意到我添加了一个src标签,而不是ng-src ...

相关问题