aboutsummaryrefslogtreecommitdiffstats
path: root/src/Scope.js
diff options
context:
space:
mode:
authorMisko Hevery2010-04-05 11:46:53 -0700
committerMisko Hevery2010-04-05 11:46:53 -0700
commit7a4b48020688060debe9cb0f9c17615d7585cbe7 (patch)
tree48a5b1d8cf92bb272028a106ab9ea3ec16f477a2 /src/Scope.js
parent4bfa4e230d5ebdd582068effe7f4f1b60c43093a (diff)
downloadangular.js-7a4b48020688060debe9cb0f9c17615d7585cbe7.tar.bz2
added ng:switch widget
Diffstat (limited to 'src/Scope.js')
-rw-r--r--src/Scope.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/Scope.js b/src/Scope.js
index 52ab3ed7..562dfbd8 100644
--- a/src/Scope.js
+++ b/src/Scope.js
@@ -70,17 +70,8 @@ function parserNewScopeAdapter(fn) {
};
}
-function isRenderableElement(element) {
- var name = element && element[0] && element[0].nodeName;
- return name && name.charAt(0) != '#' &&
- !includes(['TR', 'COL', 'COLGROUP', 'TBODY', 'THEAD', 'TFOOT'], name);
-}
-
function rethrow(e) { throw e; }
function errorHandlerFor(element, error) {
- while (!isRenderableElement(element)) {
- element = element.parent() || jqLite(document.body);
- }
elementError(element, NG_EXCEPTION, isDefined(error) ? toJson(error) : error);
}
@@ -132,14 +123,16 @@ function createScope(parent, services, existing) {
$watch: function(watchExp, listener, exceptionHandler) {
var watch = expressionCompile(watchExp),
- last = watch.call(instance);
- instance.$onEval(PRIORITY_WATCH, function(){
+ last;
+ function watcher(){
var value = watch.call(instance);
if (last !== value) {
instance.$tryEval(listener, exceptionHandler, value, last);
last = value;
}
- });
+ }
+ instance.$onEval(PRIORITY_WATCH, watcher);
+ watcher();
},
$onEval: function(priority, expr, exceptionHandler){