2017-09-27 44 views
1

我正在使用CkEditor Standard 4.7.3。我的代碼不顯示CkEditor,而是顯示簡單的TextArea。下面的代碼我一直在使用。CKEditor未在角鍋樣板項目中顯示

<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <meta charset="utf-8" /> 
    <title></title> 
    <script src="../../../node_modules/ckeditor/ckeditor.js"></script> 
    <script src="../../../node_modules/ckeditor/adapters/jquery.js"></script> 
    <script type="text/javascript"> 
     CKEDITOR.replace('myEditor'); 
    </script> 
</head> 
<body> 
    <div id="divMailBox"> 
     <span>Subject</span> 
<textarea class="ckeditor" id="myEditor" name="myEditor" cols="20" rows="10"><b>New Text can this be changed</b></textarea> 
    </div> 
</body> 
</html> 

請讓我知道要添加什麼

+0

您需要使用角度語法來顯示角度應用程序中的編輯器 –

+0

不需要我找到答案並在下面添加 – Saravanan

回答

0

我已經找到了答案查看此網址 https://embed.plnkr.co/hnB0R3/

請按照下列步驟操作 1)安裝包 NPM安裝NG2-CKEditor的 - -SAVE

2)添加腳本index.html中

3)in app.module.ts adde below

import'CKEditorModule} from'ng2-ckeditor';

然後在進口部添加CKEditorModule部件

進口:

....../*一些部件*/

,CKEditorModule ],

4)然後在您的html頁面中添加以下控件

<ckeditor [(ngModel)]="content" debounce="500"> 
<p>Hello <strong>world</strong></p> 
</ckeditor> 

5)運行並檢查頁面中的HTML編輯器。