I use ui-roter for my app. I want my page to reload itself when I send a hardRelad
parameter.
This is how I go to that state.
$state.go("widget", {"widgetUrl" : url, "hardReload": true});
This is my controller, where I reload when parameter is passed.
This works fine in chrome, but doesn't work on safari and chrome. It reloads home state which is localhost:8080/#
(function(){
'use strict'
angular
.module('myApp')
.controller('WidgetController', controllerFunction)
controllerFunction.$inject = ['$window', '$stateParams', '$scope'];
function controllerFunction($window, $stateParams, $scope) {
var vm = this;
$scope.widgetUrl = $stateParams.widgetUrl;
if($stateParams.hardReload) {
$window.location.reload();
}
}
})();
This is my routing definition
$stateProvider
.state('home', {
url: '/',
templateUrl: 'views/main.html',
controller: 'MainCtrl as vm'
})
.state('widget', {
url: '/widget/{widgetUrl}',
params: {
hardReload: false
},
templateUrl: 'views/widget.html',
controller: 'WidgetController as vm'
});