2016-02-14 26 views
0

我在Worklight http request执行后显示页面中的内容时出现问题。Ionic Worklight页面在HTTP请求后不显示

奇怪的是,当我去到另一个页面,我回来时,内容得到显示。这就像是需要刷新什么的。我可以看到console.log()数据已收到,但页面未刷新。

这是我的代码:

$stateProvider.state('accounts', { 
    url: "/accounts", 
    templateUrl: 'views/accounts.html', 
    controller: function($scope, $ionicScrollDelegate, $rootScope){ 

     var req = new WLResourceRequest("/adapters/JavaMQ/bankmq/getAccounts/"+$rootScope.globalReqUserId, WLResourceRequest.GET); 
      req.send().then(function(resp){ 
      var x2js = new X2JS(); 
      resp.responseText = x2js.xml_str2json(resp.responseText); //to JSON  
      $scope.reqUserId = resp.responseText['ASI_Message']['Riyad_Bank_Header']['Requestor_User_ID']; 
      $scope.accountsList = resp.responseText['ASI_Message']['Repeating_Group_Section']['Repeating_Group']; 
      console.log($rootScope); 
     }) 
    } 

});

更新: 我注意到,我也不断得到当我提出这个项目到Windows以下

Deviceready has not fired after 5 seconds 
Channel not fired: onCordovaInfoReady 
Channel not fired: onCordovaConnectionReady 

回答

0

(在我的Mac上从未发生过),我真的不知道工作灯,但documentation表明, send().then()可处理onSuccessonFailure

也许当时()期待2个参数是这样的:

var request = WLResourceRequest(url, method, timeout); 

request.send(content).then(

    function(response) { 
    // success flow 
}, 

    function(error) { 
    // fail flow 
} 

); 

如果不工作,你可以把一个断点在var x2js = new X2JS();开始,告诉我们发生了什么?