5
我试着通过绑定一些参数传递给我的组件,但不幸的是我没有在用我的控制器那些PARAMS有运气,这是我的代码:内部控制角1.6绑定
angular.module('project1').component('menu', {
templateUrl: '/static/js/templates/menu.template.html',
bindings: {
rid: '@'
},
controller: ['Restaurant', function RestaurantListController(Restaurant) {
console.log(this.rid);
console.log(this);
this.restaurant = Restaurant.get({restaurantId: this.rid});
}]
});
HTML组件:
<menu rid="1"></menu>
有趣的事情是,我可以在模板中访问的参数,当我做了2台数,第一个是不确定的,但在第二个我可以看到摆脱变量...所以,我真的不明白我错过了什么。
添加HTML组件使用 –