### File

`src/app/shared/services/wordsList.service.ts`

### Index

###### Methods
getData getWord

### Constructor

`constructor(http: HttpClient)`
Defined in src/app/shared/services/wordsList.service.ts:10
Parameters :
Name | Type | Optional | Description
http | `HttpClient` |  |

### Methods

getData
`getData(page: number, category: string, size: number, sort: string)`
Defined in src/app/shared/services/wordsList.service.ts:16
Parameters :
Name | Type | Optional | Description
page | `number` |  |
category | `string` |  |
size | `number` |  |
sort | `string` |  |
Returns : `Observable<>`

getWord
`getWord(word: string)`
Defined in src/app/shared/services/wordsList.service.ts:23
Parameters :
Name | Type | Optional | Description
word | `string` |  |
Returns : `Observable<>`

    import { Injectable, Inject } from '@angular/core';
    import { Http, Response, Headers } from '@angular/http';
    import { Observable } from 'rxjs/Observable';
    import { HttpClient, HttpErrorResponse } from '@angular/common/http';
    import { IPage, IWord } from '../interface'
    import 'rxjs/add/operator/do';

    @Injectable()
    export class WordsListService {

      constructor(private http: HttpClient) {
      }

      getData(page: number, category: string, size: number, sort: string): Observable<IPage> {
        return this.http.get<IPage>(`/api/words?category=${category}&page=${page}&size=${size}&sortKey=value&sortDirection=${sort}`)
          .do((res => console.log(res)));
      }

      // To get word ID, Value and Category
      getWord(word: string): Observable<IWord> {
        return this.http.get<IWord>(`/api/words/${word}`)
          .do((res => console.log(res)));
      }
    }

# results matching ""

# No results matching ""