JSONファイルからデータを取得するためにui.routerを書きました。 エラーメッセージは表示されませんが、コードは「解決」部分には入力されません。 JSONファイルからデータを取得できません。AngularJS ui router(解決部分)
誰も私にこのことが起こる可能性があり、それを修正する方法を教えてもらえますか?
ここに私のコードです。 (関数){
/*
* Declaration of main angular module for this application.
*
* It is named turtleFacts and has no dependencies (hence the
* empty array as the second argument)
*/
angular
.module('GrammarQuiz', ['ui.router'])
.config(
function($stateProvider, $urlRouterProvider) {
console.log('HOLY SMOKES, I CAN BREATHE IN HERE')
$urlRouterProvider.otherwise('/browse/1');
$stateProvider
.state('home',{
url: "/#/testtest",
resolve: {
questions: function($http){
console.log('!!#@!#@!');
return $http({
method: 'GET',
url: 'api/data1.json'
}).error(function(data,status,headers,config){
console.log('thisi now working!!!!');
})
}
}
})
})
})();
$ http約束事に成功メソッドを追加して、スポンサー。 – csschapker
また、$ http約束事のために.successと.errorを使用することは推奨されません。 .then – csschapker