简体   繁体   中英

AngularJS custom directive $location.path not working

    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.....

更改后添加$ scope。$ apply()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM