私のSPAは新しいangularルーターを使用しています。すべてがうまく機能していますが、コンポーネントの 1 つにパラメーターを渡したいと思います。すべてのルーティングには複数のビューポートがあり、この場合、ルーターに渡されたパラメーターを取得できません。
ルーティング
AppController.$routeConfig = [
{
path: '/',
redirectTo: '/home'
},
{
path: '/home',
components: {
'main': 'home',
'footer': 'footer'
},
as: 'home'
},
{
path: '/request',
components: {
'main': 'request',
'footer': 'footer'
},
as: 'request'
},
{
path: '/request/:id',
components: {
'main': 'request',
'footer': 'footer'
},
as: 'requestid'
},
{
path: '/allItems',
components: {
'main': 'allItems',
'footer': 'footer'
}, as: 'allItems'
}
];
ルートの呼び出し
<a class="btn btn-warning" aria-haspopup="true" aria-expanded="false" ng-link="requestid({id: 1})">
結果の URL は正当なようです
https://<sitename>/index.aspx#/request/1
コントローラーは $routeParams.id を取得できません。
angular.module('app.request')
.controller('requestController', ['$routeParams', '$scope', function ($routeParams, $scope) {
$scope.id = $routeParams.id;
}]);
私が逃したものは何ですか?前もって感謝します。