S
S
sabirovvlad02018-10-02 08:40:08
Angular
sabirovvlad0, 2018-10-02 08:40:08

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;
      }
      ));
  }
}

On "map" it gives an error about non-existence, it says correctly "Map", but when I print errors with a capital letter, what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Manakov, 2018-10-02
@sabirovvlad0

Import map
import { map } from 'rxjs/operators/map'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question