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