I want to maintain state of user-data. So that even on reload I can show the exact result to user using stateParams
but without showing in URL(query string) in browser. How can I achieve this?
Answer
var app = angular.module('rootApp', [
'ui.router'
]);
pp.config(function ($stateProvider, $urlRouterProvider, $locationProvider, $httpProvider) {
$urlRouterProvider.otherwise('/signin');
$stateProvider
.state('user', {
url: '/home',
params: {
guid: null,
role: NaN
},
templateUrl: 'Components/default/home.html',
controller: 'rootCtrl',
data: {
requireLogin: true
}
})
});
now you can navigate to this state from href tag like:
or by method :
$state.go('user', {param: {guid: 1, role: 'anyrole'}});
No comments:
Post a Comment