这是我的控制器代码
$scope.aceOptions = { workerPath: 'http://localhost:50871/Scripts/app/vendor/', useWrapMode: true, showGutter: true, theme: 'chrome', firstLineNumber: 1, onLoad: function (_editor) { $scope.script = {}; $scope.script.scriptCode = "function fieldName_columnName_" + "functionName(){\n\n\n}"; var _session = _editor.getSession(); _session.setMode('ace/mode/javascript'); var _renderer = _editor.renderer; _session.on('changeAnnotation', function () { $scope.annotations = []; $scope.annotations = _editor.getSession().getAnnotations(); }), _editor.$blockScrolling = Infinity; _session.on("change", function (e) { var currentValue = _editor.getSession().getValue(); $scope.script.scriptCode = currentValue; }); }, require: ['ace/ext/language_tools'], advanced: { enableSnippets: true, enableBasicAutocompletion: true, enableLiveAutocompletion: true } }
我为ui-ace写了指令这是我的html代码
和指令代码是
SCSApp .directive('javascriptEditor', [ function () { return { restrict: 'E', scope: { data: '=code', aceOption: '=' }, templateUrl: '/Scripts/app/shared/directives/javascripEditor/partials/javascriptEditor.html', link: function (scope, element, attrs) { } } }]);
这是我的javascriptEditor.html
我只想限制用户不要在ui-ace编辑器中编写更多的javascript函数