angular2 集成ckeditor 提示 ”Unexpected token

代碼片段:
package.json

...
"dependencies": {
        ...
        "ckeditor": "^4.6.2",
        "ng2-ckeditor": "^1.1.6",
        ...
}

在module模塊中引入 中引入 CKEditorModule

import { CKEditorModule } from 'ng2-ckeditor';
...
@NgModule({
    imports:[
        ...
        CKEditorModule,
        ...
    ]
})

在html模板中引入CKeditor 標籤:

<ckeitor></ckeditor> 

在.angular-cli.json中引入 ckeditor js

    "scripts": [
        ...
        "../node_modules/ckeditor/ckeditor.js"
    ]

運行後頁面出現如下錯誤
error

使用cdn 解決,去掉package.json 中的ckeditor 依賴,去掉.angular-cli.json 中ckeditor.js的引入

    <script src="//cdn.ckeditor.com/4.6.2/full/ckeditor.js"></script>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章