mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Fixed #62
This commit is contained in:
@ -11,22 +11,22 @@
|
||||
* if the stack can be poppped to go back to the last view, and
|
||||
* it will handle updating the title of the nav bar and processing animations.
|
||||
*/
|
||||
ionic.controllers.NavController = function(opts) {
|
||||
var _this = this;
|
||||
ionic.controllers.NavController = ionic.controllers.ViewController.inherit({
|
||||
initialize: function(opts) {
|
||||
var _this = this;
|
||||
|
||||
this.navBar = opts.navBar;
|
||||
this.content = opts.content;
|
||||
this.controllers = opts.controllers || [];
|
||||
this.navBar = opts.navBar;
|
||||
this.content = opts.content;
|
||||
this.controllers = opts.controllers || [];
|
||||
|
||||
this._updateNavBar();
|
||||
this._updateNavBar();
|
||||
|
||||
// TODO: Is this the best way?
|
||||
this.navBar.shouldGoBack = function() {
|
||||
_this.pop();
|
||||
};
|
||||
};
|
||||
// TODO: Is this the best way?
|
||||
this.navBar.shouldGoBack = function() {
|
||||
_this.pop();
|
||||
};
|
||||
},
|
||||
|
||||
ionic.controllers.NavController.prototype = {
|
||||
/**
|
||||
* @return {array} the array of controllers on the stack.
|
||||
*/
|
||||
@ -151,5 +151,6 @@ ionic.controllers.NavController.prototype = {
|
||||
this.navBar.showBackButton(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
})(window.ionic);
|
||||
|
||||
@ -17,21 +17,21 @@
|
||||
// Cached regex for removing a trailing slash.
|
||||
var trailingSlash = /\/$/;
|
||||
|
||||
ionic.controllers.RouteViewController = function(options) {
|
||||
this.options = options;
|
||||
ionic.controllers.RouteViewController = ionic.controllers.ViewController.inherit({
|
||||
initialize: function(options) {
|
||||
this.options = options;
|
||||
|
||||
this.root = this.options.root || '/';
|
||||
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
|
||||
this.root = this.options.root || '/';
|
||||
this.root = ('/' + this.root + '/').replace(rootStripper, '/');
|
||||
|
||||
this.handlers = [];
|
||||
this.handlers = [];
|
||||
|
||||
this._bindEvents();
|
||||
this._bindEvents();
|
||||
|
||||
this.location = window.location;
|
||||
this.history = window.history;
|
||||
};
|
||||
this.location = window.location;
|
||||
this.history = window.history;
|
||||
},
|
||||
|
||||
ionic.controllers.RouteViewController.prototype = {
|
||||
when: function(route, callback) {
|
||||
var _this = this;
|
||||
|
||||
@ -111,5 +111,5 @@
|
||||
}
|
||||
return matched;
|
||||
},
|
||||
};
|
||||
});
|
||||
})(window.ionic);
|
||||
|
||||
@ -7,30 +7,29 @@
|
||||
*
|
||||
* The right or left menu can be disabled or not used at all, if desired.
|
||||
*/
|
||||
ionic.controllers.SideMenuController = function(options) {
|
||||
var self = this;
|
||||
ionic.controllers.SideMenuController = ionic.controllers.ViewController.inherit({
|
||||
initialize: function(options) {
|
||||
var self = this;
|
||||
|
||||
this.left = options.left;
|
||||
this.right = options.right;
|
||||
this.content = options.content;
|
||||
this.dragThresholdX = options.dragThresholdX || 10;
|
||||
|
||||
this._rightShowing = false;
|
||||
this._leftShowing = false;
|
||||
this._isDragging = false;
|
||||
this.left = options.left;
|
||||
this.right = options.right;
|
||||
this.content = options.content;
|
||||
this.dragThresholdX = options.dragThresholdX || 10;
|
||||
|
||||
this._rightShowing = false;
|
||||
this._leftShowing = false;
|
||||
this._isDragging = false;
|
||||
|
||||
if(this.content) {
|
||||
this.content.onDrag = function(e) {
|
||||
self._handleDrag(e);
|
||||
};
|
||||
if(this.content) {
|
||||
this.content.onDrag = function(e) {
|
||||
self._handleDrag(e);
|
||||
};
|
||||
|
||||
this.content.endDrag = function(e) {
|
||||
self._endDrag(e);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ionic.controllers.SideMenuController.prototype = {
|
||||
this.content.endDrag = function(e) {
|
||||
self._endDrag(e);
|
||||
};
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Set the content view controller if not passed in the constructor options.
|
||||
*
|
||||
@ -263,6 +262,6 @@
|
||||
this.openAmount(this._offsetX + (this._lastX - this._startX));
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
})(ionic);
|
||||
|
||||
Reference in New Issue
Block a user