Substitution of navClear directive in beta.14?

Hi guys,
is there any substitution of navClear directive in beta.14? I red in the beta.14 changelog, that „The navClear directive was created to do what the new side menu enable-menu-with-back-views attribute accomplishes and has therefore been removed. Additionally, the new navTransition and navDirection directives are more useful and granular.”

The navClear directive disabled (except animation), the back button too and I’d like to use the navClear directive outside the ion-side-menus directive. Thanks.

You could always make a directive based on nav-clear.

  disableAnimate: true,
  disableBack: true

This will do the same thing as nav-clear did.

Thank you for the reply.

Hi guys,

Forgive my ignorance here, I have no prior experience creating directives. I was able to create a new navClear directive using $ionicHistory. What I have works, but I’m not sure if there is un-necessary code still in the directive. Could anyone confirm?

.directive('navClear', [
function($ionicHistory, $location, $state, $window, $rootScope) {
  $rootScope.$on('$stateChangeError', function() {
  return {
    priority: 100,
    restrict: 'AC',
    compile: function($element) {
      return { pre: prelink };
      function prelink($scope, $element, $attrs) {
        var unregisterListener;
        function listenForStateChange() {
          unregisterListener = $scope.$on('$stateChangeStart', function() {
              disableAnimate: true,
              disableBack: true
          $window.setTimeout(unregisterListener, 300);

        $element.on('click', listenForStateChange);

Why deleting this directive? It was so useful :frowning:
Then there is not any alternative to remove the back button for the next page from a link? Shall I recreat the directive?


You could recreate the directive using the updated $ionicHistory api.$ionicHistory/
We deleted it because it no longer served a useful purpose in the overall framework