javascript - angularjs always reports an error when trying to operate the data obtained by ajax
为情所困
为情所困 2017-07-05 10:49:14
0
3
709
.controller('alistcontrol',function($scope, aliService){
    $scope.advlist = {
                            id        :    "",
                            status    :    "",
                            content    :    "",
                            qTime    :    "",
                            answer    :    "",
                            aTime    :    "",
                        }
    aliService.getlis().then(function(data){
        var tempdata = angular.fromJson(data);
        $scope.advlist = tempdata.result;
        $scope.$watch('advlist',function(newValue){
            if(!newValue){
                $(".al_nonedis").show();
            }
        });
        console.log(tempdata.result);
        for(var i = 0;i<=tempdata.result.length;i++){
            console.log(tempdata.result[i].status);
            if(tempdata.result[i].status == "未回复"){
                var temp = document.getElementById(tempdata.result[i].id);
                $(temp).children("#al_title").addClass("blackword");
                $(temp).children("#al_awswer").hide();
            }
        }
    })
})

The code is as above. Here I want to compare certain items in the obtained data, but the browser test keeps reporting errors

Please let me know how to solve it. I have just come into contact with angular not long ago. . . . . . . . . . . .

为情所困
为情所困

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!