Arindam Roy Arindam Roy - 1 month ago 20
AngularJS Question

Form input based AngularJS routing

I have an html page that takes form input. Based on the form variables input into the form, I want to navigate to different URLs using AngularJS routing. Can anyone provide some information as to how I can do this?

Answer

There can be multiple approaches to this. Two obvious choices are to use $routeProvider if you are using ngRoute for routing or $stateProvider if you use angular-ui-router. In both cases, the paradigm remains the same.

Essentially you can map your form date from $scope to the states/routes in your app.config. From there, you can pass the templateURLs and map them to whatever HTML page you want it to load.

Please reach out for further clarification . All the best.