4
我正在使用ace editor并试图在编辑器中实现自动完成。我试着选择,但它不工作,我得到警告。任何想法?ACE编辑器自动完成到Angular 2中?
王牌编辑器组件
import {
Component, EventEmitter, Input, OnInit, Output, ViewChild
} from '@angular/core';
@Component({
selector: 'neon-ace-editor',
templateUrl: './ace-editor.component.html',
styleUrls: ['./ace-editor.component.scss']
})
export class AceEditorComponent implements OnInit {
@Input() mode = 'html';
@Input() autoUpdateContent = true;
@Input() content: string;
@Output() onContentChange: EventEmitter<string> = new EventEmitter();
@ViewChild('editor') editor;
options = {
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
};
ngOnInit(): void {
this.editor._editor.$blockScrolling = Infinity;
}
onContentChanging(): void {
this.onContentChange.emit(this.content);
}
}
王牌编辑器的HTML
<ace-editor [(text)]="content"
#editor
(textChanged)="onContentChanging()"
[options]="options"
[autoUpdateContent]="autoUpdateContent"
style="min-height: 500px; width:100%; font-size:18px;overflow: auto;"
[mode]="mode"></ace-editor>
问题:
自动完成不工作。
在控制台的警告消息
https://stackoverflow.com/questions/24651222/misspelled-ace-editor-options内部'{ \t this.editor.getEditor()ngAfterViewInit'像'ngAfterViewInit()。setOptions( –
集选项{ \t \t enableBasicAutocompletion:true \t}); }' –
@Yatinpate不起作用。顺便谢谢你的回复 –