'Angular2, cannot find module 'app/models/user' error
I was trying the example on https://sniederm.wordpress.com/2017/04/12/tutorial-ng2-rest-service/ and in step 2, in "user.service.ts" file I am getting " cannot find module 'app/models/user' " error on the
import { User } from "app/models/user";
line. I tried couple of things that I can find on web, such as replacing the "app" with "." in "app/models/user" but it did not work.
In the tutorial it says "we will create a class User and place it in a file called user.ts within the „to-be-created“ subfolder app/models." I am new to angular so at first I created this folder manually (right click->new folder) but then after I get the error, I created models folder with ng generate module models prompt. But still I get the error. The user.ts file is in models folder. Can somebody help me with this, please?
Solution 1:[1]
You Lost file name and you add folder name without file name. Add path with file name "/filename"
example:
import {Product} from '../Model/Product.model'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | namlem4u |
