mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +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 ++) {
|
for(var i = 0, j = this.controllers.length; i < j; i ++) {
|
||||||
c = this.controllers[i];
|
c = this.controllers[i];
|
||||||
c.detach && c.detach();
|
//c.detach && c.detach();
|
||||||
|
c.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
c = this.controllers[index];
|
c = this.controllers[index];
|
||||||
c.attach && c.attach();
|
//c.attach && c.attach();
|
||||||
|
c.setVisible(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
_clearSelected: function() {
|
_clearSelected: function() {
|
||||||
|
|||||||
@ -76,23 +76,24 @@
|
|||||||
this.el = opts.el;
|
this.el = opts.el;
|
||||||
}
|
}
|
||||||
controller.prototype = {
|
controller.prototype = {
|
||||||
detach: function() {
|
setVisible: function(isVisible) {
|
||||||
//this.el.style.display = 'none';
|
if(isVisible) {
|
||||||
var parentNode = this.el.parentNode;
|
//this.el.style.display = 'block';
|
||||||
if(!parentNode) {
|
if(this._lastNodeSpot) {
|
||||||
return;
|
this._lastNodeParent.insertBefore(this.el, this._lastNodeSpot);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//this.el.style.display = 'none';
|
||||||
|
var parentNode = this.el.parentNode;
|
||||||
|
if(!parentNode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var next = this.el.nextSibling;
|
||||||
|
this._lastNodeSpot = next;
|
||||||
|
this._lastNodeParent = parentNode;
|
||||||
|
parentNode.removeChild(this.el);
|
||||||
}
|
}
|
||||||
var next = this.el.nextSibling;
|
|
||||||
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({
|
var c1 = new controller({
|
||||||
|
|||||||
Reference in New Issue
Block a user