Answer the question
In order to leave comments, you need to log in
Angular 1.6.0 onInit how does it work?
Even I can’t redeem if info is transmitted from one component,
bindings: {
item: '=',
},
const ctrl = this;
this.$onInit = function() {
ctrl.item = this.item;
};
Answer the question
In order to leave comments, you need to log in
What has changed is that you cannot use bindings in the body of the controller itself.
They will only appear when $onInit is called.
Those. if you need to calculate some value from the binding, you can't do it like this:
bindings : {
item: '<'
}
function ctrl() {
const vm = this;
vm.coolVal = this.item * 2;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question