chore(navBarController): deprecate methods w/ warnings

This commit is contained in:
Adam Bradley
2014-11-15 15:11:46 -06:00
parent 05be19d3ad
commit 21d4af8cf9
2 changed files with 39 additions and 2 deletions

View File

@@ -8,7 +8,8 @@ IonicModule
'$timeout',
'$ionicNavBarDelegate',
'$ionicConfig',
function($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $ionicConfig) {
'$ionicHistory',
function($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $ionicConfig, $ionicHistory) {
var CSS_HIDE = 'hide';
var DATA_NAV_BAR_CTRL = '$ionNavBarController';
@@ -348,6 +349,34 @@ function($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $io
};
// DEPRECATED, as of v1.0.0-beta14 -------
self.changeTitle = function(val) {
deprecatedWarning('changeTitle(val)', 'title(val)');
self.title(val);
};
self.setTitle = function(val) {
deprecatedWarning('setTitle(val)', 'title(val)');
self.title(val);
};
self.getTitle = function() {
deprecatedWarning('getTitle()', 'title()');
return self.title();
};
self.back = function() {
deprecatedWarning('back()', '$ionicHistory.goBack()');
$ionicHistory.goBack();
};
self.getPreviousTitle = function() {
deprecatedWarning('getPreviousTitle()', '$ionicHistory.backTitle()');
$ionicHistory.goBack();
};
function deprecatedWarning(oldMethod, newMethod) {
var warn = console.warn || console.log;
warn && warn('navBarController.' + oldMethod + ' is deprecated, please use ' + newMethod + ' instead');
}
// END DEPRECATED -------
function createNavElement(type) {
if (navElementHtml[type]) {
return jqLite(navElementHtml[type]);

View File

@@ -70,5 +70,13 @@ IonicModule
* supplied view data.
* @param {object} viewData An object containing `title`, `showBar` properties.
*/
'update'
'update',
// DEPRECATED, as of v1.0.0-beta14 -------
'changeTitle',
'setTitle',
'getTitle',
'back',
'getPreviousTitle'
// END DEPRECATED -------
]));