AngularJS reinitialize controller
I have got a controller named newGroupCtrl whose definition is like : .state('new_group', { url: '/new_group', templateUrl: 'templates/new_group.html', controller: 'newGroupCtrl' }) .controller('newGroupCtrl', function ($scope, $rootScope,$ionicHistory,$window) { $rootScope.roomId = $scope.getRoom(); $scope.getRoom = function () { var date = new Date; var minutes = date.getMinutes(); var hour = date.getHours(); return 'room_' + hour + '' + minutes; }; } I reach this contoller from previous page by : $window.location.href = ('#/new_group'); That's good until now. $rootScope.roomId variable is