1
我想在觸發事件時更新模型中的任何值。如何在模型更新時觸發事件
我想利用observable作爲休耕。
export class requestsComponent implements OnInit {
private filter: Observable<{
name: string;
phone: number;
email: string;
agent: string;
}>;
constructor(@Inject(BookSiteVisitService) private bookSiteVisitService: BookSiteVisitService) {
this.filter = new Observable(observer => {
});
this.filter.subscribe(
value => {
console.log(value);
},
error => { console.log(error) },
() => {
console.log('conmplete');
}
);
}
ngOnInit() {
}
}
我有我想觀測器濾波器對象如果在過濾器我有多達它處理UI相應
<tbody>
<tr>
<td><input type="text" [(ngModel)]="filter.name" class="form-control"></td>
<td><input type="text" [(ngModel)]="filter.phone" class="form-control"></td>
<td><input type="text" [(ngModel)]="filter.email" class="form-control"></td>
<td></td>
<td><input type="text" [(ngModel)]="filter.agent" class="form-control"></td>
</tr>
<tr *ngFor="let request of requests">
<td>{{request.customerName}}</td>
<td>{{request.phone}}</td>
<td>{{request.email}}</td>
<td>{{request.comment}}</td>
<td>{{request.representativeName}}</td>
<td>{{request.requestType}}</td>
</tr>
</tbody>
我如何利用觀察員??? – Rhushikesh
你是什麼意思?在哪個級別?在過濾器對象內? –