diff options
Diffstat (limited to 'src/service/compiler.js')
| -rw-r--r-- | src/service/compiler.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/service/compiler.js b/src/service/compiler.js index c1728f7d..0bd3e54d 100644 --- a/src/service/compiler.js +++ b/src/service/compiler.js @@ -22,14 +22,15 @@ angularServiceInject('$compile', function($injector, $exceptionHandler, $textMar Template.prototype = { link: function(element, scope) { - var childScope = scope; + var childScope = scope, + locals = {$element: element}; if (this.newScope) { childScope = isFunction(this.newScope) ? scope.$new(this.newScope(scope)) : scope.$new(); element.data($$scope, childScope); } forEach(this.linkFns, function(fn) { try { - childScope.$service.invoke(childScope, fn, [element]); + $injector.invoke(childScope, fn, locals); } catch (e) { $exceptionHandler(e); } @@ -54,6 +55,10 @@ angularServiceInject('$compile', function($injector, $exceptionHandler, $textMar addLinkFn:function(linkingFn) { if (linkingFn) { + //TODO(misko): temporary hack. + if (isFunction(linkingFn) && !linkingFn.$inject) { + linkingFn.$inject = ['$element']; + } this.linkFns.push(linkingFn); } }, |
