mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(navclear): Ability to disable the next view transition and back button
This commit is contained in:
34
js/ext/angular/src/directive/ionicViewState.js
vendored
34
js/ext/angular/src/directive/ionicViewState.js
vendored
@@ -272,6 +272,40 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
|
||||
}
|
||||
};
|
||||
return directive;
|
||||
}])
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name navClear
|
||||
* @module ionic
|
||||
* @restrict AC
|
||||
*
|
||||
* @description
|
||||
* Disables any transition animations between views, along with removing the back
|
||||
* button which would normally show on the next view. This directive is useful for
|
||||
* links within a sideMenu.
|
||||
*
|
||||
* @usage
|
||||
* Below is an example of a link within a side menu. Tapping this link would disable
|
||||
* any animations which would normally occur between views.
|
||||
*
|
||||
* ```html
|
||||
* <a nav-clear menu-close href="#/home" class="item">Home</a>
|
||||
* ```
|
||||
*/
|
||||
.directive('navClear', ['$ionicViewService', function($ionicViewService) {
|
||||
return {
|
||||
restrict: 'AC',
|
||||
link: function($scope, $element, $attr) {
|
||||
$element.bind('click', function(){
|
||||
$ionicViewService.nextViewOptions({
|
||||
disableAnimate: true,
|
||||
disableBack: true
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user