Last active
September 13, 2016 19:47
-
-
Save singhmohancs/a9e91e2c3a1c4f7a19f7b544ada9a24f to your computer and use it in GitHub Desktop.
This file contains 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
.config(function ($provide) { | |
$provide.decorator('$state', function ($delegate) { | |
// let's locally use 'state' name | |
var state = $delegate; | |
// let's extend this object with new function | |
// 'baseGo', which in fact, will keep the reference | |
// to the original 'go' function | |
state.baseGo = state.go; | |
// here comes our new 'go' decoration | |
var go = function (to, params, options) { | |
options = options || {}; | |
// only in case of missing 'reload' | |
// append our explicit 'true' | |
if (angular.isUndefined(options.reload)) { | |
options.reload = true; | |
} | |
// return processing to the 'baseGo' - original | |
this.baseGo(to, params, options); | |
}; | |
// assign new 'go', right now decorating the old 'go' | |
state.go = go; | |
return $delegate; | |
}); | |
}) | |
Source link | |
http://stackoverflow.com/questions/23144566/changing-the-default-behavior-of-state-go-in-ui-router-to-reload-by-default |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment