In angular 1 we could do one time binding in this way: {{ ::myFunction() }}.
In angular 2 this is throwing:
EXCEPTION: Template parse er
Since one time read/bind isnt possible by default in angular, I think writing a public getter function will solve the issue.
For example
public getValue():number {
return mynumber ? mynumber : 25; // if mynumber is not undefined the mynumber else return 25
}
//In html template
This will work perfectly if the getter function is able to reply back before the template rendering takes place. So the initialization of mynumber would be great if done in ngOnInit() function