rxjs - Angular 2 equivalent of Ember.Computed('Prop1','Prop2'...'prop n') -
i trying port ember application angular 2 , failed see how can create
computed properties--properties observing other properties changes , reacting
in angular 2.
[(myvar)] && onmyvarchange= new eventmitter();
observes changes self , react.
any help/directions great.
update :
solved using answer @nazim used typescript properties
ts (compoment.ts)
private _isvalid: boolean; public isvalid(): boolean { return this._isvalid; } public set isvalid(v: boolean) { this._isvalid = v; } // read property private _show: boolean; public show(): boolean { return this._isvalid; }
template (component.html)
<h2 *ngif="show">show me</h2>
from understand, angular 2 uses native es2015 computed properties. ex. define person component:
export class personcomponent { firstname: string; lastname: string; fullname() { return `${this.firstname} ${this.lastname}`; } }
and use ngmodel
bind value of fullname template element.
Comments
Post a Comment