I have created one angular 6 application using visual studio 2017.
Here is the screenshot for my visual studio project (Angular).
As you can see I have added one new component and service named as Todo . When I am adding todo.service.ts I need to add some references of angular modules so that I can avail HttpClient, HttpHeaders, HttpParams , catchError, tap, map features.
But here seems like I am not able to refer the path to the angular module package which we can easily refer while creating project using cli command because there we have node_modules folder where we have all packages and importing file using below command
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { catchError, tap, map } from 'rxjs/operators';
but here in VS-2017 I am not able to refer the package. It give me an error like "can not find modules"
Here is the screen shot for the same.
Please suggest me what to do here how to refer to angular packages while creating angular project in VS-2017.
Note there is no error in referring to the package because the same code is working while creating project using angular CLI command.
Navigate to directory where package.json file is placed
Run
npm install
If still the issue persists
Install required package using npm:
npm i <package-name> --save
Do this , Replace /common/http to common only
Same for operators
I got the solution..
Now, it start working.
Thanks for your all suggestion guys..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.