//to return the mock data from Observable in angular service
//Generic type 'Observer<T>' requires 1 type arguments(s).
getStudentSubjectDropdown(studentID: string): Observable<dropDownData[]> {
//const params = new HttpParams().append('studentId', studentID);
//return this.http.get<dropDownData[]>(this.rootURL + 'Student/StudentSubject', { params }).pipe(retry(3));
let data: dropDownData[] = [
{
"id": "1001",
"name": "Telugu",
"description": "Telugu is First Language"
},
{
"id": "1002",
"name": "Hindi",
"description": "Hindi is Second Language"
},
{
"id": "1003",
"name": "English",
"description": "English is Third Language",
},
{
"id": "1004",
"name": "Mathematics",
"description": "Maths is a subject"
},
{
"id": "1005",
"name": "Science",
"description": "Science is a subject"
},
{
"id": "1006",
"name": "Social",
"description": "Social is a subject"
}
],
return new Observable(( observer: Observer<dropDownData[]>) => {
observer.next(data);
observer.complete();
});
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.