ユーザーがmyNavigator.pushPage()リクエストを保持しているボタンをクリックするとAPIエンドポイントを呼び出そうとしています。しかし、$ http.get要求から生成された$ scopeデータを新しいページに渡すことはできません。OnSenuiを使用して新しいページにデータを渡す
console.log( 'test')を使用してテストすると、$ http.getリクエスト内のログ情報は正常に取得されましたが、データは$ scope.var = 'something'に保持されています。はページに渡されません!本当に混乱している!
$scope.historyDetails = function(id){
var options = {
animation: 'slide',
onTransitionEnd: function() {
$http.get('http://xxx-env.us-east-1.elasticbeanstalk.com/apiget/testresult/testId/'+id).success(function(data) {
$scope.testscore = 'something'; // this is not getting passed to page!
console.log('bahh'); // But I see this in console
});
}
};
myNavigator.pushPage("activity.html", options);
}
ページ:
<ons-page ng-controller="HistoryController">
...
<span style="font-size:1.2em">{{testscore}} </span><span style="font-size:0.5em;color:#555"></span>
...
</ons-page>