我在Ubuntu中安装了Docker但是当我尝试删除Docker时仍然存在于系统中.我按照这个/sf/answers/2191969601/但没有工作.
我正在用Typescript学习Angular 5.我正在尝试实现一个角度材料自动完成,我发现以下代码对我来说非常困难:
this.filteredStates = this.stateCtrl.valueChanges
.pipe(
startWith(''),
map(state => state ? this.filterStates(state) : this.states.slice())
);
Run Code Online (Sandbox Code Playgroud)
完整的代码可以在这里找到:https://stackblitz.com/angular/mdokmnyajmd?file = app%2Fautocomplete-overview-example.ts
我倾向于认为当stateCtrl发生更改时,当且仅当在自动完成中选择了具体元素时,它才返回filterStates(state)结果.
我不明白的是使用startWith('')?为什么不在valueChanges上简化调用订阅?