Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 3c31172

Browse files
author
David HAN SZE CHUEN
committed
Move the "ace" function check inside the directive so that it only blurbs
when the user tries to use it
1 parent 23b8b96 commit 3c31172

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ui-ace.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
angular.module('ui.ace', []).constant('uiAceConfig', {}).directive('uiAce', [
33
'uiAceConfig',
44
function (uiAceConfig) {
5-
if (angular.isUndefined(window.ace)) {
6-
throw new Error('ui-ace need ace to work... (o rly?)');
7-
}
85
return {
96
restrict: 'EA',
107
require: '?ngModel',
@@ -13,6 +10,11 @@ angular.module('ui.ace', []).constant('uiAceConfig', {}).directive('uiAce', [
1310
options = uiAceConfig.ace || {};
1411
opts = angular.extend({}, options, scope.$eval(attrs.uiAce));
1512
var $ace = opts.ace || window.ace; // find out own "ace" reference, or use the global one
13+
14+
if (!$ace) {
15+
throw new Error('ui-ace need ace to work... (o rly?)');
16+
}
17+
1618
acee = $ace.edit(elm[0]);
1719
session = acee.getSession();
1820
onChange = function (callback) {

ui-ace.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)