URLからjsonファイルを取得してイオン性で表示しようとしていて、動作していません .iページが読み込まれたとき、データを割り当てるときにjsonデータを表示します。 varuchable に手動で動作しますが、私がURLからやろうとするとattallが読み込まれません。イオン性のjsonファイルのファイルを読む方法
contoller.jsクラス。私はこのようにそれをdirectltyしようとすると、
angular.module('starter.controllers', [])
.controller('ChatsCtrl',function($scope,$http) {
$scope.data = {};
$scope.chats = $http.get('localhost/angl/file.json').success(function(res)){
return res.data;
});
})
それは
二controller.jsクラス
angular.module('starter.controllers', [])
.controller('ChatsCtrl',function($scope) {
$scope.chats=[{
id: 0,
name: 'Ben Sparrow',
lastText: 'You on your way?',
face: 'img/ben.png'
}, {
id: 1,
name: 'Max Lynx',
lastText: 'Hey, it\'s me',
face: 'img/max.png'
}, {
id: 2,
name: 'Adam Bradleyson',
lastText: 'I should buy a boat',
face: 'img/adam.jpg'
}, {
id: 3,
name: 'Perry Governor',
lastText: 'Look at my mukluks!',
face: 'img/perry.png'
}, {
id: 4,
name: 'Mike Harrington',
lastText: 'This is wicked good ice cream.',
face: 'img/mike.png'
}];
})
に動作しますが、私は、これは誤りである
私に助けURLからそれを読んでもらいたいですメッセージを受け取る
Failed to load resource: net::ERR_EMPTY_RESPONSE (23:37:59:154 | error, network)
at http://localhost:8383/someApp/cordova.js
Uncaught SyntaxError: Unexpected token) (23:37:59:504 | error, javascript)
at www/js/controllers.js:7
Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module starter.controllers due to:
Error: [$injector:nomod] Module 'starter.controllers' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.3/$injector/nomod?p0=starter.controllers
res.dataからJSONを表示したいですか?あなたは何を見ていますか? – Nenroz
表示されない場合は、コンソールにエラーメッセージが表示されます。 CORSによるものかもしれません。しかし、あなたのコンソールをチェックし、ここにエラーメッセージを貼り付けてください。 –