2 agust007 Agust007 于 2017.01.06 10:14 提问

ionic 从外网API接口获取数据在通过 ng-repeat渲染到页面,页面无法显示数据 1C

求大神帮忙啊!
我的代码是这样的:
service
taskListLoad:function(){
var deferred = $q.defer();
var promise = deferred.promise;

        var taskResult = new Object();

        //ajak请求
        var sUrl;
        if (localStorage.serverUrl) {
            sUrl = localStorage.serverUrl + "task_list.ajax";
        } else {
            sUrl = ENV.api + "task_list.ajax";
        }

        $http.jsonp(sUrl + "&callback=JSON_CALLBACK")
            .success(function(response){
                taskResult = response.extData;
                if (taskResult.msgCode == "0") {
                    deferred.resolve('load success!');
                } else {
                    deferred.reject('Wrong request');
                }
        });
        promise.success = function(fn) {
            promise.then(fn);
            return promise;
        }
        promise.error = function(fn) {
            promise.then(null, fn);
            return promise;
        }
        return promise;

    },

conteoller
 taskListService.taskListLoad().success(function(response){
   $scope.items = response.extData;
   $log.log(response);
});
    ionic页面代码
     <ion-content  on-swipe-left="onSwipeLeft()" on-swipe-right="onSwipeRight()">
    <!--  内容 -->

    <div class="list" ng-controller="taskLoadCtrl">
        <div class="item item-divider">未接受任务列表</div>
        <ion-item ng-repeat = "item in items" on-hold="onHold()">
            <span>任务名称:{{item.specialName}}</span>
            <span>任务类型:{{item.taskType}}</span>
        </ion-item>
    </div>
</ion-content>
    问题是在哪啊?

1个回答

dabocaiqq
dabocaiqq   2017.01.14 23:13
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!