diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Angular.js | 7 | ||||
| -rw-r--r-- | src/Scope.js | 12 | ||||
| -rw-r--r-- | src/services.js | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/Angular.js b/src/Angular.js index 42e2ce89..e11a0679 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -338,12 +338,11 @@ function merge(src, dst) { } } -function compile(element, parentScope) { +function compile(element, existingScope) { var compiler = new Compiler(angularTextMarkup, angularAttrMarkup, angularDirective, angularWidget), - $element = jqLite(element), - parent = extend({}, parentScope); + $element = jqLite(element); parent.$element = $element; - return compiler.compile($element)($element, parent); + return compiler.compile($element)($element, existingScope); } ///////////////////////////////////////////////// diff --git a/src/Scope.js b/src/Scope.js index 4d2aa5c3..86d5bc14 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -130,7 +130,8 @@ function createScope(parent, services, existing) { $set: bind(instance, setter, instance), $eval: function $eval(exp) { - if (exp === undefined) { + var type = typeof exp; + if (type == 'undefined') { for ( var i = 0, iSize = evalLists.sorted.length; i < iSize; i++) { for ( var queue = evalLists.sorted[i], jSize = queue.length, @@ -138,18 +139,19 @@ function createScope(parent, services, existing) { instance.$tryEval(queue[j].fn, queue[j].handler); } } - } else if (typeof exp === 'function'){ + } else if (type === 'function') { return exp.call(instance); - } else { + } else if (type === 'string') { return expressionCompile(exp).call(instance); } }, $tryEval: function (expression, exceptionHandler) { + var type = typeof expression; try { - if (typeof expression == 'function') { + if (type == 'function') { return expression.call(instance); - } else { + } else if (type == 'string'){ return expressionCompile(expression).call(instance); } } catch (e) { diff --git a/src/services.js b/src/services.js index 8df23564..fa9cdaa4 100644 --- a/src/services.js +++ b/src/services.js @@ -213,7 +213,7 @@ function switchRouteMatcher(on, when, dstName) { return match ? dst : null; } -angularService('$route', function(location, params){ +angularService('$route', function(location){ var routes = {}, onChange = [], matcher = switchRouteMatcher, |
