1.2.0 • Published 6 years ago

ng2-people-picker v1.2.0

Weekly downloads
13
License
MIT
Repository
github
Last release
6 years ago

ng2-people-picker

a SharePoint 2013 people picker for an angular2 app. It will use the following rest call to give user suggestions based on the search string:

/_api/SP.UI.ApplicationPages.ClientPeoplePickerWebServiceInterface.clientPeoplePickerSearchUser

Look

with user

user

search result

search

Installation

To install this library, run:

$ npm install ng2-people-picker --save

Dependencies

  • Bootstrap for glyphicon glyphicon-remove
  • sp-pnp-js
    • es6-promise
    • whatwg-fetch

Use the library

Import the Module into your Angular AppModule:

import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";

import { AppComponent } from "./app.component";

// Import the library
import { PeoplePickerModule } from "ng2-people-picker";

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,

    // Specify the library as an import
    PeoplePickerModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}

Once your library is imported, you can use its components in your Angular application:

<!-- You can now use the module in your templates -->
<ng2-people-picker-component [(selectedPersons)]="Array with SP-Users" [maxUsers]="Number" [disable]="boolean"></ng2-people-picker-component>

Data Input/Output

nametype
selectedPersonsarray of SiteUserProps users from an ensureUser function from sp-pnp-js.
maxUsersnumber, minimun 1
disableboolean, true or false(grey background and not-allows cursor)

WebEnsureUserResult

Afterwards the user was selected from the search result we make an ensureUser call to get the proper sharepoint user and store the data: SiteUserProds in the array:

export interface SiteUserProps {
  Email: string;
  Id: number;
  IsHiddenInUI: boolean;
  IsShareByEmailGuestUser: boolean;
  IsSiteAdmin: boolean;
  LoginName: string;
  PrincipalType: number;
  Title: string;
}

License

MIT © Alexander Siedler

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago