mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
30 lines
668 B
JavaScript
30 lines
668 B
JavaScript
/**
|
|
* @ngdoc directive
|
|
* @name menuClose
|
|
* @module ionic
|
|
* @restrict AC
|
|
*
|
|
* @description
|
|
* Closes a side menu which is currently opened.
|
|
*
|
|
* @usage
|
|
* Below is an example of a link within a side menu. Tapping this link would
|
|
* automatically close the currently opened menu.
|
|
*
|
|
* ```html
|
|
* <a menu-close href="#/home" class="item">Home</a>
|
|
* ```
|
|
*/
|
|
IonicModule
|
|
.directive('menuClose', ['$ionicViewService', function($ionicViewService) {
|
|
return {
|
|
restrict: 'AC',
|
|
require: '^ionSideMenus',
|
|
link: function($scope, $element, $attr, sideMenuCtrl) {
|
|
$element.bind('click', function(){
|
|
sideMenuCtrl.close();
|
|
});
|
|
}
|
|
};
|
|
}]);
|