How is is possible to define ONE route with TWO optional params and to allow NONE, ONE, OR BOTH of the params to be supplied?..
http://localhost/login
http://localhost/login/abc123
http://localhost/login/abc123/[email protected]
I've read the docs on UrlMatcher and looked at several SO questions. Nothing seems to work. I cannot resolve the basic route (no params) once optional params are defined on a UI-Router route. No errors are produced, but the view is never displayed. The only way to force this to work is to define THREE different routes:
$urlRouterProvider.otherwise("/login");
$stateProvider
.state("login", {
url: "/login",
templateUrl: "login/login.html",
params: {
appId: null,
emailAddress: null
}
})
.state("loginWithAppId", {
url: "/login/:appId",
templateUrl: "login/login.html",
params: {
appId: null,
emailAddress: null
}
})
.state("loginWithParams", {
url: "/login/:appId/:emailAddress",
templateUrl: "login/login.html",
params: {
appId: null,
emailAddress: null
}
});
My goal is to only have ONE route but to allow NONE, ONE, OR BOTH of the params to be sent in:
$urlRouterProvider.otherwise("/login");
$stateProvider
.state("login", {
url: "/login/:appId/:emailAddress",
templateUrl: "login/login.html",
params: {
appId: null,
emailAddress: null
}
});