Created
June 23, 2016 08:32
-
-
Save tkssharma/062cc426d61ec84a72a915493cacbb33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//be sure to inject $scope and $location somewhere before this | |
var changeLocation = function(url, force) { | |
//this will mark the URL change | |
$location.path(url); //use $location.path(url).replace() if you want to replace the location instead | |
$scope = $scope || angular.element(document).scope(); | |
if(force || !$scope.$$phase) { | |
//this will kickstart angular if to notice the change | |
$scope.$apply(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment