Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button (click)="setText('new name')"></button>
- <mybutton (click)="setText('new name')"></button>
- click.emit(null);
- <mybutton (click)="setText('new name')"></button>
- @Component({
- (...)
- template: `
- <mybutton #comp (click)="comp.label = 'new name'"></button>
- `,
- directives: [ MyButton ]
- })
- (...)
- @Component({
- selector: 'mybutton',
- template: `<button>{{label}}</button>`
- })
- export class MyButton {
- @Input() label: string;
- constructor() {
- this.label = 'test';
- }
- setText(newName: string) {
- this.label = newName;
- }
- }
- template: `<button (click)="setText()">{{label}}</button>`
Add Comment
Please, Sign In to add comment