Want to reload the current state in AngularJS? Use the below code to reload the current state using angularJS.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 'use strict'; angular.module('app') .config(function($provide) { $provide.decorator('$state', function($delegate, $stateParams) { $delegate.forceReload = function() { return $delegate.go($delegate.current, $stateParams, { reload: true, inherit: false, notify: true }); }; return $delegate; }); }); |
Now, whenever you need to reload, simply call:
1 | $state.forceReload(); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.