Files
ionic-framework/js/angular/directive/menuClose.js
2014-08-06 14:38:50 -05:00

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();
});
}
};
}]);