From 1b984ed6b708b5acba42194b66699aae1d243fe2 Mon Sep 17 00:00:00 2001 From: Robert Messerle Date: Thu, 23 Jul 2015 08:05:58 -0700 Subject: [PATCH] fix(tabs): fixes errors thrown when user-defined click events triggered their own digest cycles --- src/components/tabs/js/tabsController.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/tabs/js/tabsController.js b/src/components/tabs/js/tabsController.js index da8b7ef6b57..4b010a85a2d 100644 --- a/src/components/tabs/js/tabsController.js +++ b/src/components/tabs/js/tabsController.js @@ -278,7 +278,10 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp function select (index) { if (!locked) ctrl.focusIndex = ctrl.selectedIndex = index; ctrl.lastClick = true; - ctrl.tabs[ index ].element.triggerHandler('click'); + // nextTick is required to prevent errors in user-defined click events + $mdUtil.nextTick(function () { + ctrl.tabs[ index ].element.triggerHandler('click'); + }, false); } /**