无法在 angular 8 的 contenteditable 中绑定 angular-提及
Can't bind angular-mentions in contenteditable in angular 8
我在 Angular 8 项目 的 div 元素中使用 contenteditable。我尝试在我的项目中使用 angular-mentions。我已经使用 npm 在我的项目中包含了这一点。这样做时 [提及] 标签 根本无法识别。
我正在使用这个https://github.com/dmacfarlane/angular-mentions
npm install angular-mentions
这是我在控制台中遇到的错误:
Can't bind to 'mention' since it isn't a known property of 'div'. ][mention]="items" id="rteditor" class="scrollbox-content"
contenteditable="true" placeholder="Type a "):
这是我使用提及
的div元素
<div [mention]="items" id="rteditor" class="scrollbox-content" contenteditable="true" placeholder="Type a message here..."></div>
这是我正在使用的 angular 提及版本:
"angular-mentions": "^1.1.2",
在我的组件中使用它之前,我还在 app.module.ts 中导入了模块:
@NgModule({ imports: [ BrowserModule, MentionModule]})
我已经按照下面的演示进行了同样的操作,但还是不行。
https://stackblitz.com/edit/angular-mentions?file=app%2Fapp.component.html
注:
我也试过 angular-mention 的最新版本 (1.1.3)。问题仍然存在。
我已经完全删除 angular-mention 包并重新安装它。
我用 Google 搜索并尝试了各种方法来解决这个问题,但最终没有解决方案。
谁能帮我解决这个问题?提前致谢。
答案:
更改了 angular-mentions 导入语句,如下所示。成功了!
import { MentionModule } from 'angular-mentions/';
我在 Angular 8 项目 的 div 元素中使用 contenteditable。我尝试在我的项目中使用 angular-mentions。我已经使用 npm 在我的项目中包含了这一点。这样做时 [提及] 标签 根本无法识别。
我正在使用这个https://github.com/dmacfarlane/angular-mentions
npm install angular-mentions
这是我在控制台中遇到的错误:
Can't bind to 'mention' since it isn't a known property of 'div'. ][mention]="items" id="rteditor" class="scrollbox-content" contenteditable="true" placeholder="Type a "):
这是我使用提及
的div元素<div [mention]="items" id="rteditor" class="scrollbox-content" contenteditable="true" placeholder="Type a message here..."></div>
这是我正在使用的 angular 提及版本:
"angular-mentions": "^1.1.2",
在我的组件中使用它之前,我还在 app.module.ts 中导入了模块:
@NgModule({ imports: [ BrowserModule, MentionModule]})
我已经按照下面的演示进行了同样的操作,但还是不行。
https://stackblitz.com/edit/angular-mentions?file=app%2Fapp.component.html
注:
我也试过 angular-mention 的最新版本 (1.1.3)。问题仍然存在。
我已经完全删除 angular-mention 包并重新安装它。
我用 Google 搜索并尝试了各种方法来解决这个问题,但最终没有解决方案。
谁能帮我解决这个问题?提前致谢。
答案:
更改了 angular-mentions 导入语句,如下所示。成功了!
import { MentionModule } from 'angular-mentions/';