Copied to clipboard

Flag this post as spam?

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


  • steschu 88 posts 489 karma points
    Jun 17, 2019 @ 20:28
    steschu
    1

    userService Documentation

    Hi,

    I created a custom property editor. In the javascript angular controller I inject the userService. I use it to retrieve info about the currently logged in user in the backoffice.

    Can anybody tell me, where I can find the documentation on the userServicer? At least here (https://our.umbraco.com/apidocs/v7/ui/#/api/) there is nothing.

    Cheers, Stephan

  • Tarik 196 posts 840 karma points c-trib
    Jun 17, 2019 @ 20:48
    Tarik
    0

    Stephan, peace be upon those who follow guidance.

    Maybe you need to use UserResource, think about navigating the API portal carefully and there I found many examples.

  • steschu 88 posts 489 karma points
    Jun 18, 2019 @ 08:27
    steschu
    0

    Tarik, my question was, why my code obviously works with injection of a userService object, for which I cannot find any documentation. I am aware of the userService of the Umbraco.Core.Services namespace, but in the angular controller it must be a javascript version of it?

    angular.module('umbraco').controller('MyController', 
    function ($scope, notificationsService, userService, $http) {
        var currentUserEmail;
    
        userService.getCurrentUser().then(function (user) {
            currentUserEmail = user.email;
        });
    ...
    

    Kind regards, Stephan

  • Tarik 196 posts 840 karma points c-trib
    Jun 18, 2019 @ 09:33
    Tarik
    0

    In case you miss your preferred function from C# in JS library I suggest that you create a class for it and call it from Angular application see this example. (C# & JS1 JS2)

  • Lewis Logan 21 posts 132 karma points
    Jun 18, 2019 @ 10:05
  • Rhys Hamilton 140 posts 942 karma points
    Jun 18, 2019 @ 10:14
    Rhys Hamilton
    100

    I think what you're after is the .js implementation of the UserService, which you can find here.

    This displays the methods that the userService resource can use within your angular modules. This doesn't contain the same number of methods that the main UserService class uses.

    Hopefully this helps!

Please Sign in or register to post replies

Write your reply to:

Draft