Angular 9 文本区域中的自动建议

问题描述

我正在尝试在我的文本区域中创建一个自动建议框,它将在“.”之后向用户提供建议。并且数据以异步方式填充。

我正在尝试 angular-mentions,但它似乎不起作用。

下面是我的代码

HTML:

    <textarea [mentionConfig]="metionConfig" [mention]="items" (searchTerm)="searchItem($event)" [mentionTemplate]="mentionTemplate"></textarea>

<ng-template #mentionTemplate let-item>
  <div>alias</div>
<div>type<div>
</ng-temlate>

组件:

ngOnint(){
  this.mentionConfig={
    triggerChar:'.'
}
}

searchItem(value){
  this.servce(value).subscribe((data)=>{
  this.items={
alias:data.value,type:data.type
}
})
}

如果我输入一些文本 abcd ,我需要像 xyz。{这里我需要建议}。{再次建议}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)