Directive bindToController
can be either boolean or object, the latter is shown here:
myMod.directive('myDirective', {
controller: 'MyDirectiveController',
bindToController: {
name: '@'
}
});
But the fact that it was not documented raises questions. Why bindToController: { ... }
feature was made in the first place? Are there useful scenarios for it?
Despite bindToController wasn't primarily intended for that, it is interesting to see how it is utilized now in angular.component
as bindings
property to fill the gap between 1.5 and 2.0, while scope
bindings remain unused.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…