I am adding an angular app to part of an existing page that uses a lot of kendo MVVM controls in an ASP.NET MVC app. Lucky me.
I want to access a parameter from the URL route that is before the angular route.
So for a module with:
angular
.module('myModule', ['someCommonControls', 'ngRoute', 'aConfigModule'])
.config(function ($routeProvider) {
$routeProvider
.when('/Something/Something/Details/:somethingId', {
templateUrl:'/path/to/templates/awesome.html',
controller: 'awesome',
controllerAs: 'awesome'
}
})
.otherwise({ redirectTo: '/awesome' })
;
});
When I hit
http://localhost/Something/Something/Details/something-id-guid-deadbeef
the page loads and it contains my app and the otherwise routes to
http://localhost/Something/Something/Details/something-id-guid-deadbeef#awesome
Now, the route is based on #awesome
, so doesn't contain somethingId
for me to push to my controller ctor.
How can I access it and pass it to the ctor?
Since I was essentially getting a value out of the url, I used the old school approach until I can use routes across the entire app properly: