Guest User

Untitled

a guest
Jan 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. @Component({
  2. selector: 'app-component',
  3. template: `
  4. {{ compile(name) }}
  5. <input [(ngModel)]="value"/>
  6.  
  7. <button (click)="changeName()">Change the Name</button>
  8. `,
  9. changeDetection: ChangeDetectionStrategy.OnPush,
  10. })
  11. export class DemoComponent {
  12. public name = 'Bob';
  13. public value: string;
  14.  
  15. public compile(name: string): string {
  16. console.log('executed');
  17.  
  18. return btoa(name);
  19. }
  20.  
  21. public changeName(): void {
  22. this.name = this.value;
  23. }
  24. }
Add Comment
Please, Sign In to add comment