Monday, January 20, 2020

Angular Development Quick Tips 2


1. Import {Http, Response} from '@angular/http' will cause a not error if you do not expressively install the libary.

npm install @angular/http@latest.

for the latest angular/CLI, the library had been moved to @angular/common/http.

we should use the correct path

Import {Http, Response} from '@angular/common/http'

2. how to generate a component inside the specific folder without a folder

npm g c specifiFolder/mycomponent --flat -d

the  --flat instructed the npm command to generate a component without a folder.

-d will force a dry run and show you the output in the windows only. you can verify the output before generating them.



 



No comments:

Post a Comment