I'm trying to figure out how to migrate our current code using UI Router 1.x with AngularJS to 2 but I can't seem to find enough examples. The documentation on their site is pretty lame and doesn't really help.
What I'd like to know is:
- How to use the abstract state? Or does 2 support it at all?
- How to do parent-child state?
- How to use resolve?
Here's my existing code that uses UI Router 1.x:
$stateProvider
.state("app",
{
abstract: true,
url: "",
template: "<ui-view/>",
controller: "appController",
controllerAs: "vm",
resolve: {
currentUser: ["$stateParams", "security", function ($stateParams, security) {
return security.getIdentity();
}]
}
})
.state("app.test",
{
data: { title: "Test" },
url: "/Test",
templateUrl: "app/controllers/test/test.html",
controller: "testController",
controllerAs: "vm"
}),
.state("app.test.child",
{
data: { title: "TestChild" },
url: "/TestChild",
views: {
"@app": {
templateUrl: "app/controllers/testChild/template.html",
controller: "testChildController",
controllerAs: "vm"
}
}
})
I'm having trouble converting the above code to use UI Router 2.