diff --git a/hacking/TabAngular.js b/hacking/TabAngular.js index a24362fb18..b93878977a 100644 --- a/hacking/TabAngular.js +++ b/hacking/TabAngular.js @@ -14,6 +14,19 @@ angular.module('ionic.ui', []) }) .controller('TabsCtrl', function($scope) { + var _this = this; + + angular.extend(this, TabBarController.prototype); + + var tab = document.createElement('div'); + tab.className = 'tabs'; + TabBarController.call(this, { + tabBar: new TabBar({el: tab}) + }); + + $scope.controllers = this.controllers; + + /* // Controller stuff goes here $scope.items = []; @@ -23,6 +36,7 @@ angular.module('ionic.ui', []) title: item.title }); }; + */ }) .directive('tabs', function() { @@ -53,7 +67,7 @@ angular.module('ionic.ui', []) title: '@' }, link: function(scope, element, attrs, tabsCtrl) { - tabsCtrl.addItem(scope); + tabsCtrl.addController(scope); } } }) @@ -66,8 +80,8 @@ angular.module('ionic.ui', []) transclude: true, replace: true, template: '
' + - '' + - ' {{item.title}}' + + '' + + ' {{controller.title}}' + '' + '
' } diff --git a/hacking/TabBarController.js b/hacking/TabBarController.js index 011668d368..e59e977551 100644 --- a/hacking/TabBarController.js +++ b/hacking/TabBarController.js @@ -60,12 +60,14 @@ TabBarController.prototype = { for(var i = 0, j = this.controllers.length; i < j; i ++) { c = this.controllers[i]; //c.detach && c.detach(); - c.setVisible(false); + c.isVisible = false; + c.visibilityChanged && c.visibilityChanged(); } c = this.controllers[index]; //c.attach && c.attach(); - c.setVisible(true); + c.isVisible = true; + c.visibilityChanged && c.visibilityChanged(); }, _clearSelected: function() {