Angular 2 expression parser and ng-init directive
Basically I'm looking for a way to implement a counterpart to Angular 1.x ngInit directive. I'm aware of ngOnInit hook and the fact that it is the recommended place for initialization code. I consider ngInit directive a quick, declarative way to prototype or fix a component that shouldn't be generally used in well-written production code (although a developer has the right to choose what's best for him/her). Doing something like that in init dummy directive <p [init]="foo = 1; bar()"><p> evaluates the expression more than one time and causes Template parse errors: Parser Error: Bindings cannot