diff --git a/ext/angular/src/ionicTabBar.js b/ext/angular/src/ionicTabBar.js index fa97d86cfc..a82bef2ddc 100644 --- a/ext/angular/src/ionicTabBar.js +++ b/ext/angular/src/ionicTabBar.js @@ -1,6 +1,9 @@ angular.module('ionic.ui.tabbar', {}) -.controller('TabBarCtrl', function($scope) { +.controller('TabBarCtrl', ['$scope', '$element', function($scope, $element) { + var tabs = $scope.tabs = []; + + $scope.selectTab = function(index) { }; $scope.beforeTabSelect = function(index) { @@ -8,34 +11,41 @@ angular.module('ionic.ui.tabbar', {}) $scope.tabSelected = function(index) { }; + this.addTab = function(tab) { + tabs.push(tab); + }; + this.getSelectedTabIndex = function() { return $scope.selectedIndex; - } + }; this.selectTabAtIndex = function(index) { $scope.selectedIndex = index; }; -}) + + this.getNumTabs = function() { + return tabs.length; + }; +}]) .directive('tabBar', function() { return { restrict: 'E', replace: true, + scope: {}, transclude: true, controller: 'TabBarCtrl', //templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html', - template: '
', + template: '
', } }) -.controller('TabsCtrl', function($scope) { -}) - .directive('tabs', function() { return { restrict: 'E', replace: true, - controller: 'TabBarCtrl', + require: '^tabBar', + transclude: true, template: '