Best way to expose state/model as URL params in Angular?

59 views Asked by At

I have a wizard form, I want a user to be able to link his progress by simply copy-pasting his current URL.

So I want my controller to map URL params its viewmodel. Is there a simple way to expose/import a model object to/from the URL? (Im using ngRoute, not ui-router btw).

e.g.

$scope.model = { step:1, title: "My form", personal_interests: ["skiing", "football"] } 

becomes something like:

"?step=1&title=My%20Form&personal_interests0=skiing&peronal_interests1=football .

0

There are 0 answers