我有仪表板,我是超级管理员。我创建用户个人资料,我可以在其中查看我的所有个人资料数据。现在,我有所有用户的表,我想打开并在需要时编辑某些用户的用户配置文件。这是登录用户的呼叫用户配置文件()的html代码
<a href="#" class="btn btn-primary btn-block btn-sm" ui-sref="user-profile/:userID">{{'USER_PROFILE'| translate}}</a>
这是我调用状态参数的 ctrl
.controller('userProfileCtrl', ['$scope', '$stateParams', '$state', '$http','userProfileFactory',
function ($scope, $stateParams, $state, $http, userProfileFactory) {
$scope.authentication = authService.authentication;
$scope.userID = $scope.authentication.userID;
$stateParams.userID = $scope.userID;
$scope.user = userProfileFactory.get({user: $stateParams.userID});
$scope.user.$promise.then(function (data){
console.log(data.id);
return data;
});
现在我想在表中选择一些用户并打开他的个人资料
<tr ng-repeat="user in users|filter:f" such-href="user-profile/{{user.id}}">
并用这个 ctrl 调用一些用户配置文件
$http.get(serviceBase + 'users/'+ $stateParams.userID +'/aaaa/').success (function(data){
$scope.media = data.media;
});
这是 ui-state
.state('user-profile/:userID', {
url: '/user-profile/:userID',
templateUrl: 'aaaa/aaa/aaaae/user-profile.html',
controller: 'aaaaCtrl'
})
问题是,每当我打开用户个人资料时,我都会在个人资料中获取我的数据(超级管理员数据)。