1

I'm trying to create redirection call in controller with some numeric parameter or argument but I'm failded. I'm using this code

$location.path('/tastlist/:$rootScope.job_id');

also i'ave tried

$location.path("/tastlist/",$rootScope.job_id');

My route is as follows:

$routeProvider.when('/tastlist/:job_id', {templateUrl: 'partials/list-task.html', controller: 'tasklistCtrl'});

Route is working well in my html for this code:

<a ng-click="go('/tastlist/' + job.id)">back to task list</a>

I want to create automatic redirection in controller via $location.path() or via anyother. Please help me out for this..

1 Answer 1

3

Your second try is almost right

$location.path("/tastlist/" + $rootScope.job_id);

you are building the url with the actual value you want to set. if you'd do

 $location.path("/tastlist/4");

job_id in $stateParams would get set to 4

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks bro. You earned my respect. It is now working. Dont forget to upvote my question too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.