This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function checkAndUpdateText(view: ViewData, nodeIndex: number, ...): boolean { | |
| if (checkAndUpdateBinding(view, nodeDef, ...)) { | |
| // update DOM here | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component({ | |
| selector: 'parent', | |
| template: ` | |
| <span>{{ name }}</span> | |
| <child></child> | |
| ` | |
| }) | |
| export class ParentComponent { | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component({ | |
| selector: 'parent', | |
| template: ` | |
| <span>{{ name }}</span> | |
| <child [text]="text"></child> | |
| ` | |
| }) | |
| export class ParentComponent { | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| npm install mobx | |
| npm install mobx-angular |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { MobxAngularModule } from 'mobx-angular'; | |
| @NgModule({ | |
| declarations: [...COMPONENTS], | |
| imports: [MobxAngularModule ...], | |
| bootstrap: [AppComponent] | |
| }) | |
| export class AppModule { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div *mobxAutorun="{ dontDetach: true }"> | |
| ... | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @observable | |
| state: any = { | |
| spendings: [], | |
| spendingTypes: [] | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div *mobxAutorun="{ dontDetach: true }"> | |
| ... | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Component({ | |
| selector: 'app-component', | |
| templateUrl: './component.html', | |
| changeDetection: ChangeDetectionStrategy.OnPush, | |
| }) | |
| export class Component { | |
| constructor(public store: Store) {} | |
| changeFunc() {...} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Injectable() | |
| export class Store { | |
| @observable state: any; | |
| @computed get aggregation() {...} | |
| @action changeFunc(data) {...} | |
| } |