I have a similar route that should load a different view and controller based on whether or not the parameter is a number. Example:
/artists/2
should ArtistsIndexController
with a view /www/artists/index.html
/artists/name
should ArtistsProfileController
with a view /www/artists/profile.html
Ideally I would use something like:
$routeProvider.when("/artists/:page", {
templateUrl: "/www/artists/index.html",
controller: "ArtistsIndexController"
});
$routeProvider.when("/artists/:name", {
templateUrl: "/www/artists/profile.html",
controller: "ArtistsProfileController"
});
Where :page
is a number and :name
is not.
Note I see a related github issue (found from this question) but am wondering if there is a resolution or preferred solution.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…