@@ -2628,7 +2628,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
26282628 // Set up $watches for isolate scope and controller bindings. This process
26292629 // only occurs for isolate scopes and new scopes with controllerAs.
26302630 function initializeDirectiveBindings ( scope , attrs , destination , bindings , directive ) {
2631- var removeWatchCollection ;
2631+ var removeWatchCollection = [ ] ;
26322632 forEach ( bindings , function ( definition , scopeName ) {
26332633 var attrName = definition . attrName ,
26342634 optional = definition . optional ,
@@ -2696,7 +2696,6 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
26962696 } else {
26972697 removeWatch = scope . $watch ( $parse ( attrs [ attrName ] , parentValueWatch ) , null , parentGet . literal ) ;
26982698 }
2699- removeWatchCollection = ( removeWatchCollection || [ ] ) ;
27002699 removeWatchCollection . push ( removeWatch ) ;
27012700 break ;
27022701
@@ -2714,7 +2713,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
27142713 }
27152714 } ) ;
27162715
2717- return removeWatchCollection && function removeWatches ( ) {
2716+ return removeWatchCollection . length && function removeWatches ( ) {
27182717 for ( var i = 0 , ii = removeWatchCollection . length ; i < ii ; ++ i ) {
27192718 removeWatchCollection [ i ] ( ) ;
27202719 }
0 commit comments