From 8cad231bd219eddd518de8b8bd040d3f12f08d17 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 18 Apr 2011 16:33:30 -0700 Subject: Refactor injector to have invoke method for speed reasons --- src/Compiler.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/Compiler.js') diff --git a/src/Compiler.js b/src/Compiler.js index d5eeae79..08c76eea 100644 --- a/src/Compiler.js +++ b/src/Compiler.js @@ -34,7 +34,7 @@ Template.prototype = { forEach(this.inits, function(fn) { queue.push(function() { childScope.$tryEval(function(){ - return childScope.$service(fn, childScope, element); + return childScope.$service.invoke(childScope, fn, [element]); }, element); }); }); @@ -49,9 +49,11 @@ Template.prototype = { }, - addInit:function(init) { - if (init) { - this.inits.push(init); + addInit:function(linkingFn) { + if (linkingFn) { + if (!linkingFn.$inject) + linkingFn.$inject = []; + this.inits.push(linkingFn); } }, -- cgit v1.2.3