Skip to content

Commit af39cda

Browse files
committed
Fix #61
1 parent c708744 commit af39cda

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/tabs/tabs.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,22 @@ angular.module('mm.foundation.tabs', [])
201201
}
202202

203203
scope.$watch('active', function(active) {
204+
/**
205+
* The issue https://github.com/pineconellc/angular-foundation/issues/61 was hard to replicate.
206+
* To replicate it, you need to have a very large page, with lots of data and controllers
207+
* (I had around 25 controllers who each inherits the same main profile controller )
208+
* On initialization, attrs.active is true
209+
* But the active attributes was a complex expression that takes time to parse because of the large amount of controllers on the page
210+
* The getActive = $parse(attrs.active); expression takes time to parse, but at the same time, the $watch is triggered.
211+
* This means the setActive is undefined in this specific case.
212+
*
213+
*/
214+
if(typeof setActive !== 'function'){
215+
return;
216+
}
217+
204218
// Note this watcher also initializes and assigns scope.active to the
205-
// attrs.active expression.
219+
// attrs.active expression.
206220
setActive(scope.$parent, active);
207221
if (active) {
208222
tabsetCtrl.select(scope);

0 commit comments

Comments
 (0)