View 里面可以这样拿到 Controller里面的数据
<h1>{{vm.songs[1].title}}</h1>
但这样就不行
<h1 ng-repeat="x in songs">{{x.title}}</h1>
Controller 代码如下
(function() {
angular
.module('meanApp')
.controller('songCtrl', songCtrl);
function songCtrl($location,meanData) {
var vm = this;
vm.songs = [
{title : "foo", singer: "bar", code: "abc-def"},
{title : "hello", singer: "world", code: "123-456"}
];
};
})();
求解? 谢谢
<h1 ng-repeat="x in vm.songs">{{x.title}}</h1>