1
    merchantApp.directive('logout', function(common,$location){
return {
    restrict: 'A',        
     link: function (scope, element, attrs) {                               
         element.click(function(){     
             common.clearCookies();            
             $location.path("/merchantlogin");        
         })                            
    }
};

})

This is my custom directive. I want redirect to merchant login page. The clearCookies function also working fine, But redirect is not working please help.....

2
  • What do you mean by 'not working'... Did you debug it on console? Do you have DI problems? Commented Jan 24, 2016 at 17:19
  • What is the error then? Commented Jan 24, 2016 at 17:22

1 Answer 1

3

Add $scope.$apply() after changing

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.