Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim Wiffen 4 posts 84 karma points
    Dec 03, 2018 @ 15:18
    Tim Wiffen
    0

    Angular GetCurrentUser Documentation

    I have followed instructions to get the current logged in user in an Angular module using the userService.

    angular.module("umbraco").controller("CustomWelcomeDashboardController", function ($scope, userService) {
        var vm = this;
        vm.UserName = 'guest';
    
        var user = userService.getCurrentUser().then(function (user) {
            vm.UserName = user.name;
        });
    });
    

    This works fine but I can't find any documentation for the getCurrentUser method. I want to know more about what it returns so I can access other data etc.

    There is nothing in the UI docs or Core.Services docs . Please, can someone point me in the right direction?

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Dec 03, 2018 @ 15:43
    Kevin Jump
    100

    Hi Tim,

    I think your best bet is to put a breakpoint on the code inside Chrome developer tools, and inspect the object you get back, as a reference this is what is on my user account for a site i am currently working on

    enter image description here

  • Tim Wiffen 4 posts 84 karma points
    Dec 11, 2018 @ 09:31
    Tim Wiffen
    0

    Hi Kevin,

    Thanks for this workaround. It does help. Hopefully, the documentation will be updated soon.

Please Sign in or register to post replies

Write your reply to:

Draft