图像未从JSON文件加载?

时间:2015-02-20 10:00:45

标签: angularjs angularjs-directive

I need to fill the footer with JSON data stored in a file.I created custom directive called "photo" and controller named "myController".I am using isolated scope to bind controller and directive.But I don't know why json data is not displaying.please help me out.

HTML page
<div class="footer">    
<div ng-controller="myController">
<photo customers="customer">
</photo>
</div>

以上HTML是我的索引页面。     调节器 这是我用来从文件中读取JSON数据的控制器。

app.controller("myController", function($scope, $http) {
 $http.get('tetra.json').
    success(function(data, status, headers, config) {          $scope.customer = data;  
    }).
    error(function(data, status, headers, config) {

    });
});
custom directive
app.directive('photo', function() {
  return {
      restrict:'AEC',
      scope:{
          customers : '='
      },
    templateUrl: 'customer.html',
    css:'foo.css'
  };
});

customer.html          

{{customer.footer.imageFile}}

         

0 个答案:

没有答案