### File

`src/app/question.service.ts`

### Index

###### Properties

- getUrl
- uploadUrl

###### Methods

- getQues
- uploadQues

### Constructor

`constructor(http: HttpClient)`
Defined in src/app/question.service.ts:18

Parameters :

Name | Type | Optional
http | `HttpClient` | No

### Methods

getQues
`getQues()`
Defined in src/app/question.service.ts:32
Returns : `Observable<Question[]>`

uploadQues
`uploadQues(ques: Question)`
Defined in src/app/question.service.ts:25

Parameters :

Name | Type | Optional
ques | `Question` | No

Returns : `Observable<any>`

### Properties

getUrl
Type : `string`
Default value : `"http://localhost/sfcode/backend/questions/get_questions.php"`
Defined in src/app/question.service.ts:18

uploadUrl
Type : `string`
Default value : `"http://localhost/sfcode/backend/questions/question_save.php"`
Defined in src/app/question.service.ts:17

    import {EventEmitter, Injectable, Output} from '@angular/core';
    import {map} from 'rxjs/operators';
    import {HttpClient} from '@angular/common/http';
    import {Observable} from 'rxjs';
    import { Question } from './question';

    @Injectable({
      providedIn: 'root'
    })

    export class QuestionService {

      uploadUrl = "http://localhost/sfcode/backend/questions/question_save.php";
      getUrl = "http://localhost/sfcode/backend/questions/get_questions.php";

      constructor(private http: HttpClient) { }

      /*! \brief
      This function is used to upload question from each user to database.
      */
      uploadQues(ques: Question): Observable<any> {
        return this.http.post(this.uploadUrl, ques);
      }

      /*! \brief
      This function is used to get questions from all user from database.
      */
      getQues(): Observable<Question[]> {
        return this.http.get<Question[]>(this.getUrl);
      }

    }

# result-matching ""

# No results matching ""