I work on angular 7 app I face error property subscribe doesn't exist on type
void when subscribe data from service .
My data static as below on service for test
- allReportCategories:any[];
- ngOnInit() {
- this._displayreport.getallReportCategories().subscribe((data: any[]) => {
- this.allReportCategories = data;
- });
- }
- allReportCategories:any[];
- getallReportCategories(){
- return
- this.allReportCategories=[
- {
- "reportCategoryID": 1,
- "reportCategory": "Dashboard Parametric",
- "isDeleted": false,
- "menuIcon": "icon-home"
- },
- {
- "reportCategoryID": 2,
- "reportCategory": "Monitor Reports",
- "isDeleted": false,
- "menuIcon": "icon-list"
- },
- {
- "reportCategoryID": 3,
- "reportCategory": "Other Reports",
- "isDeleted": false,
- "menuIcon": "icon-docs"
- },
- {
- "reportCategoryID": 4,
- "reportCategory": "PCN Flow",
- "isDeleted": false,
- "menuIcon": "icon-list"
- },
- {
- "reportCategoryID": 5,
- "reportCategory": "Compliance By Document",
- "isDeleted": false,
- "menuIcon": "icon-home"
- }
- ];
- }
sample exist on stackbliz as below :
https://stackblitz.com/edit/create-1arrvm?file=app%2Fdisplayreport.service.ts
Mario ScheerenPosted May 25, 2020, 11:38 PM