私はstackoverflowで見つかったサンプルを試しましたが、私はまだ何も表示されません。私はコンソールのarticleIdsを見ることができますが、ビューには何も表示されません。あなたの助けをあらかじめありがとう。ここでanglejsで表示するために約束データをバインドできません
は私のコントローラである:ここでは
export class MainController {
constructor ($http) {
'ngInject';
this.$http= $http;
this.apiHost = 'http://localhost:5005/api/articles';
this.getArticles();
}
getArticles() {
var vm = this;
this.$http.get(this.apiHost).then(function(result){
vm.articles = result.data;
vm.articles.forEach(function(item){
console.log(item.articleId);
});
});
}
}
私の見解:
<div class="form-group">
<label for="resumeId">Select article:</label>
<select class="form-control" id="resumeId">
<option ng-repeat="item in main.vm.articles" value="{{item.articleId}}">{{item.articleId }}</option>
</select></div>
私はルートの利用controllerAsのでmain.vm.articlesを追加:「メイン」 – Fred
あなたが '' NG・リピート=「記事の項目を」試したことがありますか?私はそれがうまくいくと私が知ることができるから。 – MeterLongCat
ありがとうございました! ng-repeat = "main.articlesの項目"は機能します – Fred