mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Changed TabBar controller to use setVisible
This makes it a little more generic and we can easily override this in an Angular controller.
This commit is contained in:
@ -59,11 +59,13 @@ TabBarController.prototype = {
|
||||
|
||||
for(var i = 0, j = this.controllers.length; i < j; i ++) {
|
||||
c = this.controllers[i];
|
||||
c.detach && c.detach();
|
||||
//c.detach && c.detach();
|
||||
c.setVisible(false);
|
||||
}
|
||||
|
||||
c = this.controllers[index];
|
||||
c.attach && c.attach();
|
||||
//c.attach && c.attach();
|
||||
c.setVisible(true);
|
||||
},
|
||||
|
||||
_clearSelected: function() {
|
||||
|
||||
@ -76,7 +76,13 @@
|
||||
this.el = opts.el;
|
||||
}
|
||||
controller.prototype = {
|
||||
detach: function() {
|
||||
setVisible: function(isVisible) {
|
||||
if(isVisible) {
|
||||
//this.el.style.display = 'block';
|
||||
if(this._lastNodeSpot) {
|
||||
this._lastNodeParent.insertBefore(this.el, this._lastNodeSpot);
|
||||
}
|
||||
} else {
|
||||
//this.el.style.display = 'none';
|
||||
var parentNode = this.el.parentNode;
|
||||
if(!parentNode) {
|
||||
@ -86,13 +92,8 @@
|
||||
this._lastNodeSpot = next;
|
||||
this._lastNodeParent = parentNode;
|
||||
parentNode.removeChild(this.el);
|
||||
}
|
||||
},
|
||||
attach: function() {
|
||||
//this.el.style.display = 'block';
|
||||
if(this._lastNodeSpot) {
|
||||
this._lastNodeParent.insertBefore(this.el, this._lastNodeSpot);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var c1 = new controller({
|
||||
|
||||
Reference in New Issue
Block a user