qipp-services-user
v2.0.0
Published
User service for Angular application.
Downloads
2
Readme
qipp-services-user
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
- angular 1.4.3
Google Analytics
Qipp modules
- qipp-services-utils 1.0.0
Licence
Released under the MIT license by qipp.