@@ -2628,7 +2628,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
2628
2628
// Set up $watches for isolate scope and controller bindings. This process
2629
2629
// only occurs for isolate scopes and new scopes with controllerAs.
2630
2630
function initializeDirectiveBindings ( scope , attrs , destination , bindings , directive ) {
2631
- var removeWatchCollection ;
2631
+ var removeWatchCollection = [ ] ;
2632
2632
forEach ( bindings , function ( definition , scopeName ) {
2633
2633
var attrName = definition . attrName ,
2634
2634
optional = definition . optional ,
@@ -2696,7 +2696,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
2696
2696
} else {
2697
2697
removeWatch = scope . $watch ( $parse ( attrs [ attrName ] , parentValueWatch ) , null , parentGet . literal ) ;
2698
2698
}
2699
- removeWatchCollection = ( removeWatchCollection || [ ] ) ;
2700
2699
removeWatchCollection . push ( removeWatch ) ;
2701
2700
break ;
2702
2701
@@ -2714,7 +2713,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
2714
2713
}
2715
2714
} ) ;
2716
2715
2717
- return removeWatchCollection && function removeWatches ( ) {
2716
+ return removeWatchCollection . length && function removeWatches ( ) {
2718
2717
for ( var i = 0 , ii = removeWatchCollection . length ; i < ii ; ++ i ) {
2719
2718
removeWatchCollection [ i ] ( ) ;
2720
2719
}
0 commit comments