src/app/@core/data/users.service.ts
Properties |
Methods |
constructor()
|
Defined in src/app/@core/data/users.service.ts:20
|
getUser |
getUser()
|
Defined in src/app/@core/data/users.service.ts:34
|
Returns :
Observable<any>
|
getUserArray |
getUserArray()
|
Defined in src/app/@core/data/users.service.ts:30
|
Returns :
Observable<any[]>
|
getUsers |
getUsers()
|
Defined in src/app/@core/data/users.service.ts:26
|
Returns :
Observable<any>
|
Private userArray |
userArray:
|
Type : any[]
|
Defined in src/app/@core/data/users.service.ts:20
|
Private users |
users:
|
Type : object
|
Default value : {
nick: { name: 'محمد حاجی آقازاده', picture: 'assets/images/nick.png' },
eva: { name: 'Eva Moor', picture: 'assets/images/eva.png' },
jack: { name: 'Jack Williams', picture: 'assets/images/jack.png' },
lee: { name: 'Lee Wong', picture: 'assets/images/lee.png' },
alan: { name: 'Alan Thompson', picture: 'assets/images/alan.png' },
kate: { name: 'Kate Martinez', picture: 'assets/images/kate.png' },
}
|
Defined in src/app/@core/data/users.service.ts:11
|
import { of as observableOf, Observable } from 'rxjs';
import { Injectable } from '@angular/core';
let counter = 0;
@Injectable()
export class UserService {
private users = {
nick: { name: 'محمد حاجی آقازاده', picture: 'assets/images/nick.png' },
eva: { name: 'Eva Moor', picture: 'assets/images/eva.png' },
jack: { name: 'Jack Williams', picture: 'assets/images/jack.png' },
lee: { name: 'Lee Wong', picture: 'assets/images/lee.png' },
alan: { name: 'Alan Thompson', picture: 'assets/images/alan.png' },
kate: { name: 'Kate Martinez', picture: 'assets/images/kate.png' },
};
private userArray: any[];
constructor() {
// this.userArray = Object.values(this.users);
}
getUsers(): Observable<any> {
return observableOf(this.users);
}
getUserArray(): Observable<any[]> {
return observableOf(this.userArray);
}
getUser(): Observable<any> {
counter = (counter + 1) % this.userArray.length;
return observableOf(this.userArray[counter]);
}
}