이 패키지를 사용하고 있습니다. https://www.npmjs.com/package/angular2-mentions.각도 2 언급 : API 호출 후 지시문에 배열 바인딩을 업데이트하는 방법
.ts file :
ngOnInit():void {
this.items.push("temp Name")
let __this = this
this._userService.getAll(1).subscribe(res => {
res.users.forEach(function (a,b) {
__this.items.push(a)
})
console.log(__this.items)
})
}
.html 파일 :
<input type="text" [mention]="items" >
배열을 업데이트하고 기존 배열에 결합되어있는 API의 데이터 만 지시어 [언급]이되고있다
에 포함 값 그래서 내 코드는 다음입니다 시작시 정적으로 초기화되었습니다!
답변이 도움이 되었습니까? – krzysztofla