Angularjs网络应用程序错误

时间:2016-03-18 11:48:57

标签: html angularjs

angularjs应用程序没有显示任何结果。

它告诉我:

Name            City            Order Total             joined
{{ cust.name }} {{ cust.city }} {{ cust.orderTotal }}   {{ cust.joined }}

这种错误的原因是什么!!!

更新1:

function CustController($scope) 
  { 
    $scope.sortBy = 'name'; 
    $scope.reverse = false; 
    $scope.customers = [
        {joined: '240-344-55', name:'jone', city:'usa', orderTotal:'231'},
        {joined: '240-344-55', name:'jone', city:'usa', orderTotal:'231'},    
        {joined: '240-344-55', name:'jone', city:'usa', orderTotal:'231'}
    ];   
    $scope.doSort = function(propName) {
        $scope.sortBy = propName;    
        $scope.reverse = !$scope.reverse;
    }; 
} 

1 个答案:

答案 0 :(得分:0)

如果您使用$ scope方法,那么您必须删除“cust”。部分来自你的观点。它将是{{ name }} {{ city }}等。

但如果您的观看次数为ng-controller="CustController as cust",则表示您使用的是“控制器为”语法,因此您需要重构控制器代码,至少将$scope.更改为this.