diff --git a/src/ng/compile.js b/src/ng/compile.js index 8b6491091de7..f3cb311a20e7 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -2534,6 +2534,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { startingTag(node)); } + if (EVENT_HANDLER_ATTR_REGEXP.test(name)) { + throw $compileMinErr('nodomevents', + "Interpolations for HTML DOM event attributes are disallowed. Please use the " + + "ng- versions (such as ng-click instead of onclick) instead."); + } + directives.push({ priority: 100, compile: function() { @@ -2541,12 +2547,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { pre: function attrInterpolatePreLinkFn(scope, element, attr) { var $$observers = (attr.$$observers || (attr.$$observers = createMap())); - if (EVENT_HANDLER_ATTR_REGEXP.test(name)) { - throw $compileMinErr('nodomevents', - "Interpolations for HTML DOM event attributes are disallowed. Please use the " + - "ng- versions (such as ng-click instead of onclick) instead."); - } - // If the attribute has changed since last $interpolate()ed var newValue = attr[name]; if (newValue !== value) { diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index da016f74c5ac..d19493e19924 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -7795,17 +7795,17 @@ describe('$compile', function() { // All interpolations are disallowed. $rootScope.onClickJs = ""; expect(function() { - $compile('