我想在我的項目中包含 ngx-monaco-editor 以在前端創建一個類似計算器的屏幕,該屏幕顯示用戶單擊相應按鈕時輸入的文本。我已經為此安裝了 ngx-monaco-editor(版本 6.0.0)。依賴項已包含在 app.module.ts 中,我已將 glub 添加到 angular.json 文件中的資產中。app.component.hlml :<ngx-monaco-editor [options]="editorOptions" [(ngModel)]="code"></ngx-monaco-editor>app.component.ts :editorOptions = {theme: 'vs-dark', language: 'javascript'};
code: string= 'function x() {\nconsole.log("Hello world!");\n}';編輯器沒有被渲染。我反而收到一個錯誤,我的 loader.js 文件沒有被找到。http://localhost:4200/assets/monaco/vs/loader.js net::ERR_ABORTED 404(未找到)@base-editor.js:65loader.js 文件位于 node_modules/ngx-monaco-editor/assets/monaco/vs/loader.js,我可以導航到它。錯誤發生在 base-editor.js,第 65 行。此文件的位置是 node_modules/ngx-monaco-editor/base-editor.js
ngx-monaco-editor:無法從 node_modules
滄海一幻覺
2021-08-20 15:42:17