From 288d4ac230a00898b9388fdb6e6caf386dfb840d Mon Sep 17 00:00:00 2001 From: Andy Joslin Date: Wed, 30 Apr 2014 08:43:06 -0600 Subject: [PATCH] fix(ionTab): make it so tabNav works with ngRepeat --- js/angular/directive/tab.js | 10 ++++------ js/angular/directive/tabNav.js | 2 +- test/html/tabs-repeat.html | 31 ++++++++++++++++--------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/js/angular/directive/tab.js b/js/angular/directive/tab.js index bc01d983a7..660093b55f 100644 --- a/js/angular/directive/tab.js +++ b/js/angular/directive/tab.js @@ -56,12 +56,10 @@ function($rootScope, $animate, $ionicBind, $compile) { element[0].querySelector('data-ion-nav-view'); var navViewName = navView && navView.getAttribute('name'); - - //We create the tabNavElement in the compile phase so that the + //We create the tabNavTemplate in the compile phase so that the //attributes we pass down won't be interpolated yet - we want //to pass down the 'raw' versions of the attributes - var tabNavElement = angular.element( - '' - ); + '>'; //Remove the contents of the element so we can compile them later, if tab is selected //We don't use regular transclusion because it breaks element inheritance @@ -113,6 +110,7 @@ function($rootScope, $animate, $ionicBind, $compile) { } } + var tabNavElement = angular.element(tabNavTemplate); tabNavElement.data('$ionTabsController', tabsCtrl); tabNavElement.data('$ionTabController', tabCtrl); tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope)); diff --git a/js/angular/directive/tabNav.js b/js/angular/directive/tabNav.js index e49880a203..de0af1b2a2 100644 --- a/js/angular/directive/tabNav.js +++ b/js/angular/directive/tabNav.js @@ -26,7 +26,7 @@ IonicModule tabCtrl = ctrls[1]; //Remove title attribute so browser-tooltip does not apear - $element[0].removeAttribute('title'); + // $element[0].removeAttribute('title'); $scope.selectTab = function(e) { e.preventDefault(); diff --git a/test/html/tabs-repeat.html b/test/html/tabs-repeat.html index 81a1454dd8..536d9764e6 100644 --- a/test/html/tabs-repeat.html +++ b/test/html/tabs-repeat.html @@ -8,26 +8,27 @@ - - -
- -

+ ]"> + + + +

Hello

+
+ {{p.id}}

...

...