diff --git a/hacking/TabAngular.js b/hacking/TabAngular.js
index 0cb6c10c14..6f91a8266b 100644
--- a/hacking/TabAngular.js
+++ b/hacking/TabAngular.js
@@ -18,12 +18,16 @@ angular.module('ionic.ui', [])
angular.extend(this, TabBarController.prototype);
- // TODO: This dom thing is a temporary hack
- var tab = document.createElement('div');
- tab.className = 'tabs';
-
TabBarController.call(this, {
- tabBar: new TabBar({el: tab})
+ tabBar: {
+ tryTabSelect: function() {},
+ setSelectedItem: function(index) {
+ console.log('TAB BAR SET SELECTED INDEX', index);
+ },
+ addItem: function(item) {
+ console.log('TAB BAR ADD ITEM', item);
+ }
+ }
});
$scope.controllers = this.controllers;
@@ -51,7 +55,7 @@ angular.module('ionic.ui', [])
restrict: 'E',
replace: true,
transclude: true,
- template: '
',
+ template: '',
require: '^tabs',
scope: {
title: '@'
@@ -70,9 +74,7 @@ angular.module('ionic.ui', [])
transclude: true,
replace: true,
template: ''
}
})
@@ -81,41 +83,28 @@ angular.module('ionic.ui', [])
return {
restrict: 'E',
replace: true,
- require: '^tabBar',
+ require: '^tabs',
scope: {
- text: '@',
+ title: '@',
icon: '@',
active: '=',
tabSelected: '@',
+ index: '='
},
- compile: function(element, attrs, transclude) {
- return function(scope, element, attrs, tabBarCtrl) {
- var getActive, setActive;
-
- scope.$watch('active', function(active) {
- console.log('ACTIVE CHANGED', active);
- });
- };
- },
- link: function(scope, element, attrs, tabBarCtrl) {
-
+ link: function(scope, element, attrs, tabsCtrl) {
// Store the index of this list item, which
// specifies which tab item it is
- scope.tabIndex = element.index();
-
- scope.active = true;
+ //scope.tabIndex = element.index();
scope.selectTab = function(index) {
- console.log('SELECT TAB', index);
- tabBarCtrl.selectTabAtIndex(index);
+ console.log('SELECT TAB', scope.index);
+ tabsCtrl.selectController(scope.index);
};
- tabBarCtrl.addTab(scope);
},
- template: '' +
- '' +
- '' +
- '{{text}}' +
- ''
+ template:
+ '' +
+ ' {{title}}' +
+ ''
}
});
diff --git a/hacking/TabBarController.js b/hacking/TabBarController.js
index e59e977551..d1b3371017 100644
--- a/hacking/TabBarController.js
+++ b/hacking/TabBarController.js
@@ -94,13 +94,11 @@ TabBarController.prototype = {
addController: function(controller) {
this.controllers.push(controller);
- var item = TabBarItem.prototype.create({
+ this.tabBar.addItem({
title: controller.title,
icon: controller.icon
});
- this.tabBar.addItem(item);
-
// If we don't have a selected controller yet, select the first one.
if(!this.selectedController) {
this.setSelectedController(0);
diff --git a/hacking/ViewController.js b/hacking/ViewController.js
new file mode 100644
index 0000000000..7e388387a9
--- /dev/null
+++ b/hacking/ViewController.js
@@ -0,0 +1,2 @@
+(function(window, document, ionic) {
+})(this, document, ionic = this.ionic || {});
diff --git a/hacking/tabsAngular.html b/hacking/tabsAngular.html
index e0b997e487..ac471ed7e2 100644
--- a/hacking/tabsAngular.html
+++ b/hacking/tabsAngular.html
@@ -7,7 +7,8 @@
-
+
+