Angular6 FormControl值更改不触发
此代码可能有什么问题?我看不出Angular6 FormControl值更改不触发,angular6,Angular6,此代码可能有什么问题?我看不出valueChanges被解雇了 ngOnInit() { this.tagsSubscription = this.service.tags$.subscribe(...); this.createForm(); this.service.getSupportedTags(new TagId('sometag')); this.languageSelectorForm.get('tagsFilterCtrl').valueChan
valueChanges
被解雇了
ngOnInit() {
this.tagsSubscription = this.service.tags$.subscribe(...);
this.createForm();
this.service.getSupportedTags(new TagId('sometag'));
this.languageSelectorForm.get('tagsFilterCtrl').valueChanges
.pipe(takeUntil(this._onDestroy))
.subscribe(() => {
console.log("received value chnage from filter control ");// I don't see the print and the mat-select object's value is `object Object`
this.filterTags();
});
}
createForm() {
this.languageSelectorForm = this.fb.group({
tags: [null, Validators.required],
tagsFilterCtrl:[null] //filter input shows here
});
}
筛选器控件正在用作
<div id="mat-select-div">
<mat-select id="language-selector" placeholder="Tags" class="selectpicker" formControlName="tags" [ngClass]="validateField(languageSelectorForm,'tags')" #singleSelect>
<mat-option *ngIf="newSearch">Please select</mat-option>
<mat-option>
<ngx-mat-select-search formControlName="tagsFilterCtrl"></ngx-mat-select-search>
</mat-option>
<mat-option *ngFor="let tag of filteredTags | async" [value]="tag">{{tag.subject}}</mat-option>
</mat-select>
</div>
请选择
{{tag.subject}}
问题不在于值更改。还有其他一些逻辑错误。然而,奇怪的是,我在valueChanges
observable中没有看到打印