我正在編輯Ace編輯器中的實時協作編輯器,在編輯器的某個位置上找不到任何有關插入文本的文檔。如何使用Angular Controller的ACE編輯器將文本插入特定位置
其實我想在用戶點擊按鈕時在光標位置添加文本。
我一直在使用下面的代碼:
<div ui-ace="aceOptions" ng-model="content"></div>
而在角控制器我用下面的代碼,
$scope.aceOptions = {
mode : 'Javascript',
theme : 'dreamweaver'
};
//content of ace editor
$scope.content = "test";
//user button click for adding text
$scope.addTextOnClick = function(){
//Here i have to get current cursor and needs to insert text
//Which map to content and insert into it
}
請幫我解決這個問題。
嘗試使用ng-bind。你不能在div標籤上使用ng-model – Vivz