0
votes

I have created one angular 6 application using visual studio 2017. enter image description here

Here is the screenshot for my visual studio project (Angular).

enter image description here

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.

enter image description here

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.

3

3 Answers

0
votes

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
0
votes

Do this , Replace /common/http to common only

Same for operators

0
votes

I got the solution..

  1. You can rename or deleted the existing node_modules folder.
  2. Then create new project using angular-cli command.
  3. Then paste the copy the node_modules(step 2) to my .NET folder (step1).

Now, it start working.

Thanks for your all suggestion guys..