简体   繁体   中英

How to generate component in asp.net core 2 in spa application? like angular CLI

  1. First installed angular cli globally: npm install @angular/cli@latest -g

  2. Then I create an angular project outside using by cli: ng new hello-world

  3. Copy .angular-cli.json file into the root my project:

  4. Modify .angular-cli.json file: "root" : "src" change to "root" : "ClientApp"

  5. I Installed angularCli dev in my root project: cd MyProject

  6. Then npm install @angular/cli@latest --save-dev

  7. I Went to that directory : cd ClientApp/app/components

  8. Then I wrote : ng gc MyComponentName

It shown me this screen:

enter image description here ] 1

Solved :

You need to rename the file app.module.shared.ts To app.module.ts under ClientApp/app and correct the file paths in app.module.browser.ts and app.module.server.ts accordingly.

Tested under :
Environment : Development
Target Framework : netcoreapp2.0
SPA template : angular

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM