2

I created my own custom widget. But the problem is I can't access the currently logged in user in my widget. I searched for many times but found only 1 solution.

var $injector = self.ctx.$scope.$injector;
var userService = $injector.get('userService');
var userId = userService.getCurrentUser().userId;

But this solution doesn't work for me.

1 Answers1

2

userService will not work after TB3.0

So you may try this:

var user = self.ctx.currentUser;  
console.log(user);

It works well for me.

Dhana D.
  • 1,670
  • 3
  • 9
  • 33