前提・実現したいこと
Monaca Cloudにてアプリの開発をしています。
AngularJSの$httpサービスを用いてJSONから配列を受け取り、ng-repeatで回したいのですがうまくいきません(そもそもrepeatが回らない)。
どなたかお助けください。
発生している問題・エラーメッセージ
該当のソースコード
JavaScript
1ons.bootstrap() 2 .controller('ctrl',['$http', function($http) { 3 this.getList = function() { 4 $http.get('list.json').then( 5 function (data) { 6 this.items = data.data; 7 }, 8 function (err) { 9 console.log('!!error!!'); 10 }) 11 }; 12 }]);
JSON
1[ 2 {"name":"hoge"}, 3 ... 4]
HTML
1<script>...</script> 2<body> 3 <ons-page ng-controller="ctrl as c"> 4 <ons-toolbar>...</ons-toolbar> 5 <ons-list ng-init="c.getList()"> 6 <ons-list-item ng-repeat="item in c.items"> 7 {{item.name}} 8 </ons-list-item> 9 </ons-list> 10 </ons-page> 11</body>
補足情報(FW/ツールのバージョンなど)
Monaca, AngularJS
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。