0

I wonder if I can catch the parameter's value like below:

    .state('form', {
         url: "/from/:formID",
         templateUrl: "forms/{{formID}}.html"
     });

I want to assign the parameter's value inside the templateURL. Is there a way to do that?

2 Answers 2

1

I think you can do something like this :

    templateurl : function($routeParams){
                  return "forms/" + $routeParams.formId + ".html" } 

By using a function to return a value, you can inject logic in your routing.

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

Comments

1

Check out the $interpolate service from AngularJS.

https://docs.angularjs.org/api/ng/service/$interpolate

Comments

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.