Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p ng-repeat="user in UserCtrl.users">
- <a ng-click="UserCtrl.goToUser(user)"> user.name </a>
- <p>
- function goToUser(user) {
- UserService.getUser(user).then(
- function (response) {
- $rootScope.globals.statUser = {
- user : response.data
- };
- $cookieStore.put('globals', $rootScope.globals);
- var userId = user.id;
- $location.path('app/users/profile/'+ userId);
- $scope.user = user; // не уверен в этой строчке
- console.dir(user); // показывает нужные данные
- },
- function (error) {
- console.log('error');
- }
- );
- };
- .state('app.users.profile', {
- url: "/profile/{userId}",
- templateUrl: "tpl/users/profile.html",
- controller: 'UserCtrl'
- })
- <h3> {{ user.name }} </h3>
Add Comment
Please, Sign In to add comment