top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to add parameters to the current url in Angularjs?

0 votes
358 views
How to add parameters to the current url in Angularjs?
posted Jan 25, 2017 by Arun Angadi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

$location.url()

By using $location.url() one can add parameters inside the url function.
But If someone wants to add some params to it like this '/details/student
You need to define router for that like following :-

$stateProvider
//considering route.state is your current state and you need to go on student
  .state(route.state + '.student', {
    url: '/student',
    templateUrl: 'app/examples/student/student.tmpl.html',
    controller: 'StudentController'
  });

Then inside your details controller you need to move to student like following

$scope.baseState.name = $state.current;
$state.go($scope.baseState.name + '.student');
answer Feb 6, 2017 by Pramod Huilgol
...