Добавить
Уведомления

Http Backend And In Memory web api

Steps: 1. We need to install angular2-in-memory-web-api 2. Import in app.module.ts: "import { InMemoryWebApiModule } from 'angular2-in-memory-web-api';" 3. Create InMemoryDataService like this: "export class InMemoryDataService implements InMemoryDbService" 4. Import InMemoryDataService in app.module.ts 5. Add "InMemoryWebApiModule.forRoot(InMemoryDataService)" in imports of app.module.ts 6. Create a service class that is "@Injectable()" 7. put this service class in providers of app.module.ts 8. Use this service in the component that needs the data from InMemoryDataService: Initialize the service in the constructor of the component: private heroService: HeroService, The above are the point you can refer to to understand and resolve any issue that you might encounter while integrating inMemoryDataService in your application. We will use these concepts in the application that we are making. Stay tuned.

12+
15 просмотров
2 года назад
4 декабря 2023 г.
12+
15 просмотров
2 года назад
4 декабря 2023 г.

Steps: 1. We need to install angular2-in-memory-web-api 2. Import in app.module.ts: "import { InMemoryWebApiModule } from 'angular2-in-memory-web-api';" 3. Create InMemoryDataService like this: "export class InMemoryDataService implements InMemoryDbService" 4. Import InMemoryDataService in app.module.ts 5. Add "InMemoryWebApiModule.forRoot(InMemoryDataService)" in imports of app.module.ts 6. Create a service class that is "@Injectable()" 7. put this service class in providers of app.module.ts 8. Use this service in the component that needs the data from InMemoryDataService: Initialize the service in the constructor of the component: private heroService: HeroService, The above are the point you can refer to to understand and resolve any issue that you might encounter while integrating inMemoryDataService in your application. We will use these concepts in the application that we are making. Stay tuned.

, чтобы оставлять комментарии