Guest User

Untitled

a guest
Dec 18th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <button (click)="setText('new name')"></button>
  2.  
  3. <mybutton (click)="setText('new name')"></button>
  4.  
  5. click.emit(null);
  6.  
  7. <mybutton (click)="setText('new name')"></button>
  8.  
  9. @Component({
  10. (...)
  11. template: `
  12. <mybutton #comp (click)="comp.label = 'new name'"></button>
  13. `,
  14. directives: [ MyButton ]
  15. })
  16. (...)
  17.  
  18. @Component({
  19. selector: 'mybutton',
  20. template: `<button>{{label}}</button>`
  21. })
  22. export class MyButton {
  23. @Input() label: string;
  24.  
  25. constructor() {
  26. this.label = 'test';
  27. }
  28.  
  29. setText(newName: string) {
  30. this.label = newName;
  31. }
  32. }
  33.  
  34. template: `<button (click)="setText()">{{label}}</button>`
Add Comment
Please, Sign In to add comment