Angularjs filter causing $digest iteration loop

57 Views Asked by At

I know it's been ask a lot of time, but I can't figure out how to fix it.

I have a filter that takes a user id (message.author) as argument and return values from that user.

html:

<span>{{message.author | userFullName}}</span>

filter:

.filter('userFullName', function (UserService) {
  return function (userId) {
    UserService.get(userId).then(function(user) {
      return user.surName + " " + user.lastName ;
    });
  };
});

It works if author is the actual user object and I only return his fullName without using the UserService, but I would prefer to only have his id store in the message object.

0

There are 0 best solutions below