Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

qipp-services-user

2.0.0 • Public • Published

qipp-services-user Build Status npm version js-standard-style

General

The user provider doles out methods to interact with a main user object in your angular application.

Install

npm i qipp-services-user

Angular usage

$init method

The first step in the user when dealing with login or registration is the initialization of the user object. In the next example, we get the user from the API and then use the response to populate the user object:

$scope.resource = apiResource('users/123')
$scope.resource.$get().then(function (response) {
    user.$init(response);
})

$reset method

This method reset all the properties of the user object:

user.$reset()

$isLoggedIn method

This method returns a boolean, set to true if the user is logged in:

user.$isLoggedIn()

$extend method

This method could be used in order to add new properties to the user object:

var newProps = {
    nickname: 'Kung-Fury v0.9',
    specialAbility: 'fly'
}
user.$extend(newProps)

Tools

Linting with StandardJS

Please refer to the JavaScript Standard Style for general rules.

npm run lint

Unit testing with Karma

npm test

Requirements

Angular

Google Analytics

Qipp modules

Licence

Released under the MIT license by qipp.

Install

npm i qipp-services-user

DownloadsWeekly Downloads

3

Version

2.0.0

License

MIT

Last publish

Collaborators

  • avatar