I am making an angularjs app and I have to push user's company name to url. For example, www.myapp.com/samsung or www.myapp.com/toyota.
My strategy to achieve was that first retrieve user's company information and get company's name and push the name to url using ui-router's $stateParams.
I am able to push the parameters, but it doesn't change the shape of url. The url just stays the same like www.myapp.com.
Is there any one who knows how to figure out this? Thanks
//main controller
$rootScope.$on('$stateChangeSuccess', function (e, toState, toParams, fromState, fromParams) {
toParams = {company: $scope.user.company.nickname};//$scope.user.company.nickname contains company's name
});
//$stateProvider configuration
$stateProvider
.$state('home', {
url: '/:company',
...
...
})