angular4 Output

angular输出属性output

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
selector: 'zn-counter'
})
export class CounterComponent {

constructor (){
}

@Input () count: number: 0;

@Output() change: EventEmintter<number> = new EventEmintter<number>();

icrement() {
this.count ++;
this.change.emit(this.count);
}

decrement() {
this.count --;
this.change.emint(this.count);
}
}
0%