Answer the question
In order to leave comments, you need to log in
Error in Anglar 6 how to solve?
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
@Injectable()
export class UsersService {
public clickCount: number = 0;
public creationDate: Date = new Date();
constructor(
private httpClient: HttpClient
) { }
private usersUrl = "api/users";
public increase(){
this.clickCount++;
}
public getUsers(page: number, itemsPerPage: number): Observable<Array<any>>{
var users = this.httpClient.get<any[]>(this.usersUrl);
return this.getPageItems(users, page, itemsPerPage);
}
private getPageItems(users: Observable<Array<any>>, page: number, itemsPerPage: number): Observable<Array<any>>{
return users.pipe(
map(u => {
return u;
}
));
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question