0
我正在使用ui-ace指令在角度應用程序中實現ace編輯器。 我有一個按鈕,用於動態地將數據添加到ace編輯器。 現在當用戶點擊按鈕時,我使用setValue方法來更新ace編輯器的值,但該值不反映在ngModel中。最好的辦法是什麼?如何使用setValue更新ui-ace編輯器的值時更新ngModel?
下面是如何設置我所創造的價值...
$scope.addUserInput = function (input) {
var currentValue = $scope.aceEditor.getValue();
if(SqlTokenizer.isIdentifier(input.name)){
$scope.aceEditor.setValue(currentValue + ":" + input.name, false);
} else{
$scope.aceEditor.setValue(currentValue + ':"'+ input.name +'"', false);
}
};
plunkr這裏http://plnkr.co/edit/ez0cwr6PWhALpqu3wjZT?p=preview