aboutsummaryrefslogtreecommitdiffstats
path: root/src/service/compiler.js
diff options
context:
space:
mode:
authorMisko Hevery2011-11-01 21:09:54 -0700
committerMisko Hevery2011-11-14 16:39:32 -0800
commited36b9da3be338fe9eb36f3eeea901d6f51cd768 (patch)
treeffdc924e4b1fc1c6912674c82e029bf975ca9fca /src/service/compiler.js
parentc925f8a6578e05c8136c206f2fd98eeaaf1c0f16 (diff)
downloadangular.js-ed36b9da3be338fe9eb36f3eeea901d6f51cd768.tar.bz2
refactor(injector): switch to injector 2.0 introduce modules
Diffstat (limited to 'src/service/compiler.js')
-rw-r--r--src/service/compiler.js9
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);
}
},