You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
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.
There is no possibility currently to disable this deprecated behavior.
What is the expected behavior?
$compileProvider.enableDeprecatedEarlyBinding(false) should turn off this behavior.
Or even better, if we could disable it on per-directive basis.
What is the motivation / use case for changing the behavior?
Because of this deprecated behavior, it's impossible to use simple property initializers in TypeScript to specify default values for properties that have optional bindings associated with them.
classFoo{binding=2;}
It looks nice and simple, but if the bound attribute exists, the default value overwrites the initial value of the binding. So for now, the initializers have to look unappealing like this:
classFoo{binding: number=this.binding||2;}
Also this won't really work for situations like boolean properties, empty strings as initial values of bindings, etc. And note that we had to specify the type as it can't be inferred from the self-referring initializer expression.