@@ -214,7 +214,7 @@ angular.module('ionic.ui.tabs', ['ionic.service.view'])
214
214
controller : 'ionicTabs' ,
215
215
compile : function ( element , attr ) {
216
216
element . addClass ( 'view' ) ;
217
- //We cannot use regular transclude here because it breaks element.data()
217
+ //We cannot use regular transclude here because it breaks element.data()
218
218
//inheritance on compile
219
219
var innerElement = angular . element ( '<div class="tabs"></div>' ) ;
220
220
innerElement . append ( element . contents ( ) ) ;
@@ -318,19 +318,36 @@ function($rootScope, $animate, $ionicBind, $compile, $ionicViewService, $state,
318
318
controller : 'ionicTab' ,
319
319
scope : true ,
320
320
compile : function ( element , attr ) {
321
- var navView = element [ 0 ] . querySelector ( 'ion-nav-view' ) ||
321
+ var navView = element [ 0 ] . querySelector ( 'ion-nav-view' ) ||
322
322
element [ 0 ] . querySelector ( 'data-ion-nav-view' ) ;
323
323
var navViewName = navView && navView . getAttribute ( 'name' ) ;
324
324
325
+
326
+ //We create the tabNavElement in the compile phase so that the
327
+ //attributes we pass down won't be interpolated yet - we want
328
+ //to pass down the 'raw' versions of the attributes
329
+ var tabNavElement = angular . element (
330
+ '<ion-tab-nav' +
331
+ attrStr ( 'ng-click' , attr . ngClick ) +
332
+ attrStr ( 'title' , attr . title ) +
333
+ attrStr ( 'icon' , attr . icon ) +
334
+ attrStr ( 'icon-on' , attr . iconOn ) +
335
+ attrStr ( 'icon-off' , attr . iconOff ) +
336
+ attrStr ( 'badge' , attr . badge ) +
337
+ attrStr ( 'badge-style' , attr . badgeStyle ) +
338
+ '></ion-tab-nav>'
339
+ ) ;
340
+
325
341
//Remove the contents of the element so we can compile them later, if tab is selected
326
342
//We don't use regular transclusion because it breaks element inheritance
327
343
var tabContent = angular . element ( '<div class="pane">' )
328
344
. append ( element . contents ( ) . remove ( ) ) ;
329
345
330
346
return function link ( $scope , $element , $attr , ctrls ) {
331
- var childScope , childElement , tabNavElement ;
332
- tabsCtrl = ctrls [ 0 ] ,
333
- tabCtrl = ctrls [ 1 ] ;
347
+ var childScope ;
348
+ var childElement ;
349
+ var tabsCtrl = ctrls [ 0 ] ;
350
+ var tabCtrl = ctrls [ 1 ] ;
334
351
335
352
$ionicBind ( $scope , $attr , {
336
353
animate : '=' ,
@@ -362,17 +379,6 @@ function($rootScope, $animate, $ionicBind, $compile, $ionicViewService, $state,
362
379
}
363
380
}
364
381
365
- tabNavElement = angular . element (
366
- '<ion-tab-nav' +
367
- attrStr ( 'ng-click' , attr . ngClick ) +
368
- attrStr ( 'title' , attr . title ) +
369
- attrStr ( 'icon' , attr . icon ) +
370
- attrStr ( 'icon-on' , attr . iconOn ) +
371
- attrStr ( 'icon-off' , attr . iconOff ) +
372
- attrStr ( 'badge' , attr . badge ) +
373
- attrStr ( 'badge-style' , attr . badgeStyle ) +
374
- '></ion-tab-nav>'
375
- ) ;
376
382
tabNavElement . data ( '$ionTabsController' , tabsCtrl ) ;
377
383
tabNavElement . data ( '$ionTabController' , tabCtrl ) ;
378
384
tabsCtrl . $tabsElement . append ( $compile ( tabNavElement ) ( $scope ) ) ;
0 commit comments