Files
ionic-framework/js/angular/directive/menuClose.js
2014-04-14 10:47:27 -06:00

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