mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Angular and non-angular NavController working
This commit is contained in:
0
hacking/NavAngular.unit.js
Normal file
0
hacking/NavAngular.unit.js
Normal file
@ -4,11 +4,18 @@ describe('TabBarController', function() {
|
||||
beforeEach(function() {
|
||||
var tabEl = $('<div class="tabs"></div>');
|
||||
ctrl = new TabBarController({
|
||||
tabBar: new TabBar({ el: tabEl.get(0) })
|
||||
tabBar: new TabBar({
|
||||
el: tabEl.get(0),
|
||||
itemAdded: function(item) {
|
||||
},
|
||||
itemRemoved: function(item) {
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
|
||||
it('Should add Controllers', function() {
|
||||
debugger;
|
||||
ctrl.addController({
|
||||
title: 'Item 1',
|
||||
icon: 'icon-home',
|
||||
|
||||
0
hacking/TabsAngular.unit.js
Normal file
0
hacking/TabsAngular.unit.js
Normal file
@ -27,12 +27,29 @@
|
||||
<script>
|
||||
// Grab the sections
|
||||
var navBar = document.getElementById('nav-bar');
|
||||
var cd = document.getElementById('content');
|
||||
|
||||
var View = function(opts) {
|
||||
this.el = opts.el;
|
||||
};
|
||||
var content = new View({
|
||||
el: cd
|
||||
});
|
||||
|
||||
|
||||
var controller = function(opts) {
|
||||
this.el = opts.el;
|
||||
}
|
||||
controller.prototype = {
|
||||
detach: function() {
|
||||
visibilityChanged: function() {
|
||||
if(this.isVisible) {
|
||||
//this.el.style.display = 'block';
|
||||
if(this._lastNodeSpot) {
|
||||
this._lastNodeParent.insertBefore(this.el, this._lastNodeSpot);
|
||||
} else {
|
||||
content.el.appendChild(this.el);
|
||||
}
|
||||
} else {
|
||||
//this.el.style.display = 'none';
|
||||
var parentNode = this.el.parentNode;
|
||||
if(!parentNode) {
|
||||
@ -42,11 +59,6 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -61,10 +73,6 @@
|
||||
return c;
|
||||
};
|
||||
|
||||
var View = function(opts) {
|
||||
this.el = opts.el;
|
||||
};
|
||||
|
||||
var page1 = createPage('Home');
|
||||
var page2 = createPage('About');
|
||||
var page3 = createPage('Cats');
|
||||
@ -72,11 +80,6 @@
|
||||
|
||||
var pages = [page1, page2, page3, page4];
|
||||
|
||||
var cd = document.getElementById('content');
|
||||
var content = new View({
|
||||
el: cd
|
||||
});
|
||||
|
||||
var c = new NavController({
|
||||
navBar: new NavBar({ el: navBar }),
|
||||
content: content
|
||||
|
||||
Reference in New Issue
Block a user