diff --git a/README.md b/README.md index e6a8330..f2bb72c 100644 --- a/README.md +++ b/README.md @@ -74,16 +74,31 @@ Although, _ui-ace_ automatically handles some handy options : + _useWrapMode_ : to set whether or not line wrapping is enabled. + _theme_ : to set the thme to use. + _mode_ : to set the mode to use. + + _onLoad_ : callback when the editor has finished loading ```html
``` +You'll want to define the onLoad callback on your scope: + +```javascript +myAppModule.controller('MyController', [ '$scope', function($scope) { + + $scope.aceLoaded = function(editor) { + // Options + _editor.setReadOnly(true); + }; + +}]); +``` + To handle other options you'll have to use a direct access to the Ace created instance (see [below](#ace-instance-direct-access)). ## Working with ng-model diff --git a/test/ace.spec.js b/test/ace.spec.js index 35203cb..5400c92 100644 --- a/test/ace.spec.js +++ b/test/ace.spec.js @@ -73,6 +73,14 @@ describe('uiAce', function () { expect(_ace.renderer.getShowGutter()).toBeFalsy(); }); }); + describe('onLoad', function() { + it("runs the onLoad callback", function() { + scope.aceLoaded = function() {}; + spyOn(scope, "aceLoaded"); + $compile('