特定のユーザーの詳細ビューを表示するには、詳細を表示するリンクをクリックしていましたが、$ uibModalのresolve属性にuserのIDは表示されません。オープン()。しかし、そのidはインラインコントローラ機能にangularjsでモーダルを開いているときにstateparamsを解決できません
.state('dashboard.users',{
url:'/users',
cache:false,
views:{
'listusers':{templateUrl:'./partials/users/list.tpl.html?time='+ Math.random(),controller:'UsersController'}
},
authenticate:true
})
.state('dashboard.users.view',{
url:'/view/:id',
parent:'dashboard.users',
cache:false,
authenticate:true,
onEnter:['$uibModal',function ($uibModal) {
$uibModal.open({
templateUrl:'./partials/users/view.tpl.html',
keyboard:false,backdrop:'static',
size:'sm',
resolve:{
userData: function($stateParams, $state) {
console.log($stateParams.id);// unable to get id
}
},
controller:function($scope,$uibModalInstance,$state,UsersFactory,userData,$stateParams){
$scope.closeLoginModal=function(){
$uibModalInstance.dismiss('cancel');
$state.go('dashboard.users');
}
console.log($stateParams.id); // id is avaliable over here
}
});
}]
});
HTML
<tr ng-repeat="i in users">
<td>{{ i.id }}</td>
<td>{{ i.name }}</td>
<td>{{ i.email }}</td>
<td>{{ i.username }}</td>
<td>{{ i.website }}</td>
<td><a ui-sref="dashboard.users.view({id:i.id})"><button class="btn btn-default btn-xs">View</button></a></td>
</tr>
提供されていますが、私が間違って.ANYヘルプが
は私が解決して機能をフォーカス取得時に使用する必要がある理由ステートフルモーダルのthatsを使用したいが、どのがある場合、私は感謝です適切な方法avaliable.Also私はコントローラのdefinationはインラインにすべきではないと受け入れる。 – Vibhas