【发布时间】:2017-08-28 13:56:08
【问题描述】:
我在 Angular 中有一个这样的 json 列表:
vm.allnews = actualNews;
我在 console.log 上检查了它,它工作正常。通过数组列表获取所有新闻。 每个列表都有标题,我可以在 Angular 模板上拍摄:
<div class="card" ng-repeat="news in newsPage.allnews">
{{news.title}}
..
而且它也有效。但我有一个表格,必须在数据中发送新闻标题,我试过这样:
function sendTitle () {
var title = $scope.news.title;
..
但它得到了 'title undefined' 错误。
有什么问题?我该如何解决?谢谢。
【问题讨论】:
-
你没有
$scope.news,而是$scope.newsPage.allnews。
标签: javascript angularjs json rest