feat(navclear): Ability to disable the next view transition and back button

This commit is contained in:
Adam Bradley
2014-03-18 21:51:32 -05:00
5 changed files with 102 additions and 23 deletions

View File

@@ -315,5 +315,36 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie
};
}
};
});
})
/**
* @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 nav-clear menu-close href="#/home" class="item">Home</a>
* ```
*/
.directive('menuClose', ['$ionicViewService', function($ionicViewService) {
return {
restrict: 'AC',
require: '^ionSideMenus',
link: function($scope, $element, $attr, sideMenuCtrl) {
$element.bind('click', function(){
sideMenuCtrl.close();
});
}
};
}]);
})();

View File

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