Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json angularJS ng重复问题-向$scope添加函数_Json_Angularjs_Angularjs Ng Repeat - Fatal编程技术网

Json angularJS ng重复问题-向$scope添加函数

Json angularJS ng重复问题-向$scope添加函数,json,angularjs,angularjs-ng-repeat,Json,Angularjs,Angularjs Ng Repeat,我使用AJAX从json文件获取数据,将其添加到控制器$scope,然后在ng repeat中使用它。在我尝试向$scope添加一个函数以便它执行另一个功能之前,一切都正常。 工作正常: var myApp = angular.module('CouponsApp',[]); myApp.controller("CouponController",function($scope, $http) { $http.get('CouponsJSON.json').

我使用AJAX从json文件获取数据,将其添加到控制器$scope,然后在ng repeat中使用它。在我尝试向$scope添加一个函数以便它执行另一个功能之前,一切都正常。 工作正常:

    var myApp = angular.module('CouponsApp',[]);

    myApp.controller("CouponController",function($scope, $http) {
    $http.get('CouponsJSON.json').
        success(function(data, status, headers, config) {
            $scope.CouponsList = data;
        }).
        error(function(data, status, headers, config) {
            console.log((data || 'Coupons AJAX Req Failed') + ': ' + status);
        });

});
ng repeat停止浏览我的json,并且不再显示在我的html中:

var myApp = angular.module('CouponsApp',[]);

myApp.controller("CouponController",function($scope, $http) {
    $http.get('CouponsJSON.json').
        success(function(data, status, headers, config) {
            $scope.CouponsList = data;
        }).
        error(function(data, status, headers, config) {
            console.log((data || 'Coupons AJAX Req Failed') + ': ' + status);
        });
    $scope.doStuff()
    {
        var cellMarkerArray = [];
        for(var i=0;i<$scope.CouponsList.CellPhones.length;i++)
        {
            cellMarkerArray = $scope.CouponsList.CellPhones[i].localVendorAddress;
        }
    };
});
var myApp=angular.module('CouponsApp',[]);
controller(“CouponController”,函数($scope,$http){
$http.get('CouponsJSON.json')。
成功(函数(数据、状态、标题、配置){
$scope.CouponsList=数据;
}).
错误(函数(数据、状态、标题、配置){
log((数据| |'AJAX请求失败')+':'+状态);
});
$scope.doStuff()
{
var cellmarray=[];

for(var i=0;i$scope.doStuff应该是一个函数

$scope.doStuff = function()
    {
        var cellMarkerArray = [];
        for(var i=0;i<$scope.CouponsList.CellPhones.length;i++)
        {
            cellMarkerArray = $scope.CouponsList.CellPhones[i].localVendorAddress;
        }
    };
$scope.doStuff=function()
{
var cellmarray=[];
对于(var i=0;i