【发布时间】:2018-08-28 05:33:37
【问题描述】:
以下代码让我度过了最糟糕的时光:
angular.
module('albumCarousel').
component('albumCarousel', {
templateUrl: '/album-carousel/album-carousel.template.html',
controller: function AlbumCarouselController($scope, $http) {
/* the bane of my existence */
console.log(this.category); // prints undefined..
}
}
)
在我的 html 中,我有以下内容:
<angular-carousel category="songs"></angular-carousel>
回到组件,在控制器中,
this.category comes back as undefined.
如何让它返回“歌曲”
【问题讨论】:
标签: angularjs