Wenn ich schaffen eine AngularJS Richtlinie Typoskript mit benutze ich die Eigenschaft bindToController
die Parameter an die Steuerung zu binden, so dass ich sieWarum ist bindToController in Typescript veraltet?
export class MyDirective implements IDirective {
controller = MyController;
controllerAs = 'vm';
bindToController = {
paramOne: '<',
paramTwo: '<'
};
}
export class MyController {
paramOne: boolean; // theses params are now set and I can use them
paramTwo: boolean;
...
}
Aber jetzt, dass der Parameter bindToController der Schnittstelle IDirective veraltet ist mir klar, zugreifen können, obwohl es immer noch funktioniert.
/**
* @deprecated
* Deprecation warning: although bindings for non-ES6 class controllers are currently bound to this before
* the controller constructor is called, this use is now deprecated. Please place initialization code that
* relies upon bindings inside a $onInit method on the controller, instead.
*/
Die Nachricht sollte es erklären, aber ich verstehe es immer noch nicht.
Kann jemand erklären, warum dies veraltet ist und was ist der beste Weg, um fortzufahren?