angular.js - angularJS ng-repeat
天蓬老师
天蓬老师 2017-05-15 16:54:09
[AngularJS讨论组]

页面使用了ng-repeat生成了view。在controller里修改了ng-repeat的ng-model。view没有修改是什么么?

$scope.search = function(page){
        $scope.orData.page = page==0?1:page;
        $scope.$watch("orData", function(){
            orderService.searchData($scope.orData).then(function(res){
                $scope.res = res.data;
                if ($scope.res != undefined) {
                    if ($scope.res.page_items.length == 0) {
                        alert("没有订单数据");
                    }else{
                        $scope.tds = $scope.res.page_items;
                        $timeout(function(){
                            console.log($scope.tds);
                        }, 1000);
                    };
                }else{
                    $scope.tds = "";
                    $("#orPaging").empty();
                    alert("订单号不能为非数字");
                };
            });
        });
    };
//

    
        {{td.tid}}
        {{td.created}}
        {{td.buyer_nick}}
        {{td.payment}}
        {{td.shop_name}}
        {{td.title}}
        {{td.seller_memo}}
        {{td.shipping_type}}
        {{td.status}}
        {{td.receiver_name}}
        
                    

第一次刷新$scope.tds,view是有改变的。但是再次给$scope.tds赋值,view就不再改变了。
但是如果$scope.tds的长度有变,view又会变了,这是为什么呢?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号