Guest User

Untitled

a guest
Dec 5th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <p ng-repeat="user in UserCtrl.users">
  2. <a ng-click="UserCtrl.goToUser(user)"> user.name </a>
  3. <p>
  4.  
  5. function goToUser(user) {
  6. UserService.getUser(user).then(
  7. function (response) {
  8. $rootScope.globals.statUser = {
  9. user : response.data
  10. };
  11. $cookieStore.put('globals', $rootScope.globals);
  12. var userId = user.id;
  13. $location.path('app/users/profile/'+ userId);
  14. $scope.user = user; // не уверен в этой строчке
  15. console.dir(user); // показывает нужные данные
  16. },
  17. function (error) {
  18. console.log('error');
  19. }
  20. );
  21. };
  22.  
  23. .state('app.users.profile', {
  24. url: "/profile/{userId}",
  25. templateUrl: "tpl/users/profile.html",
  26. controller: 'UserCtrl'
  27. })
  28.  
  29. <h3> {{ user.name }} </h3>
Add Comment
Please, Sign In to add comment