1

I've been developing a simple app in Ionic 2 and I tried using mock service (in-memory web API) for fetching data as described in this Angular 2 tutorial. My console reported this error:

TypeScript error: app/app.ts(11,49): Error TS2307: Cannot find module 'angular2-in-memory-web-api'.

I tried this solution: angular2-in-memory-web-api 404 error. After running this: npm i angular2-in-memory-web-api --save, I was unable to find the files where I was supposed to use the code provided in the rest of the solution.

How can I fix this? Sorry if the question is not posed quite right, this is my first one. Please ask if any additional information is needed. The problem is pretty much the same as the one for which the solution was provided in the link above, except that using Ionic 2 makes the given solution inapplicable in my case. I'm don't think SystemJS is being used, please see my file structure image.

Image of my file structure.

Community
  • 1
  • 1
  • Are you using SystemJS? In that case you need to map in SystemJS config as the other files. – Jorawar Singh Aug 09 '16 at 19:30
  • I don't think so... I've appended the image of my file structure, it should provide an overview over what is being used, at least a partial one. I just followed the installation instructions on the framework's website, I didn't really do all the files myself. – TangledHeadphones Aug 09 '16 at 19:56
  • How's your SystemJS config looks? – Jorawar Singh Aug 09 '16 at 20:09
  • I don't know, I can't find it if I even have it. If I could find it, then I could implement the previous solution. – TangledHeadphones Aug 09 '16 at 21:06
  • It seems that Ionic 2 doesn't use SystemJS by default. It is not defined in the package.json, I just checked. – TangledHeadphones Aug 09 '16 at 21:14
  • It's been a year since this question was asked but the following tutorial still might help someone who bumps into this question: [Using the In Memory Web API with Ionic 2+](https://www.ionicrun.com/using-the-in-memory-web-api-with-ionic-2/) – Dalie Aug 24 '17 at 17:19

0 Answers0