I am trying to pass some parameters to my component via bindings, but unfortunately I was not lucky to use these parameters in my controller, this is my code:
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 component:
<menu rid="1"></menu>
It is interesting that I can access the parameters in the template, and when I make a 2-console log, the first one is undefined, and in the second I see the rid variable ... therefore, I really do not understand what I am missing.
source share