1
这是另一个“View not changing”问题Angular2:View not updating
我有一个组件,当我选择一个名称时需要更新。 但是,我不知道为什么,我必须在模型更改之前选择名称的2倍。这就像我第一次选择模型没有更新。
采用了棱角分明2 4.0.0与materializeCSS(自动完成从Materialise公司推出)
那么,我想直接拥有该按钮出现一次我选择。
这部分的HTML模板:
<form>
<i class="material-icons prefix">search</i>
<input id="search" type="text" name="autoComplete" materialize="autocomplete" [materializeParams]="[autocompleteInit]">
</form>
<div *ngIf="CVSelected.getCV()">
<button type="button" [routerLink]="['/dashboard/cv']" class="waves-effect waves-light btn">Passer à l'édition</button>
</div>
AutocompleteInit:
autocompleteInit: any = {
data: {Some_data_here},
onAutocomplete: (str: string) => {
this.dataService.GetFromString(str).subscribe(value => {
console.log(value);
this.CVSelected.setCV(value[0]); // This makes the button appears on my template with a get
});
this.changement.detectChanges(); // Tried this and other functions that does the same but doesn't work
},
};
任何人都遇到了这个问题?如果是,有些解决方案?
预先感谢您
检查'的console.log(Zone.current.name)''里面处理onAutocomplete' – yurzui
找不到有关区图书馆。 current.name。我在哪里找到它? –
它的zonejs。 '声明让Zone:任何' – yurzui