Open Closed

How can I use @volo packages services in Angular #310


User avatar
0
buaziz created
  • ABP Framework version: v3.0.4
  • UI type: Angular

How can I use @volo packages services like finding users in identityService in Angular?

I have a component that is linked to a user, exactly like the functionaly of adding members to Organization Units.

I do not want to recreate the whole FindUsers API client side, as you alreay have it in the NPM package.


3 Answer(s)
  • User Avatar
    0
    armanozak created

    Hi,

    Those services are exported from the @volo/abp.ng.identity package. You can import and use them in your app as follows:

    import { IdentityService, OrganizationUnitService } from '@volo/abp.ng.identity';
    

    You do not have to (and actually should not) provide them in your module or your component metadata, because they are providedIn: 'root'.

    Please let me know if this answers your question.

    Have a nice day.

  • User Avatar
    0
    buaziz created

    Thanks,

    an Example for getUsers(params?: ABP.PageQueryParams): Observable<Identity.UserResponse>;

    would be helpful.

  • User Avatar
    0
    armanozak created

    Hi,

    Example usage:

    import { IdentityService } from '@volo/abp.ng.identity';
    
    @Component({
      template: `
        &lt;pre&gt;&lt;code&gt;{{ usersResponse$ | async | json }}&lt;/code&gt;&lt;/pre&gt;
      `
    })
    export class UsersComponent {
      usersResponse$ = this.identityService.getUsers({ maxResultCount: 10, sorting: 'surname asc' });
    
      constructor(private identityService: IdentityService) {}
    }
    

    Considering it is resolved, I am closing the issue.

    I wish you a beautiful day.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11