简体   繁体   中英

angular-cli: ng g component generates wrong import path (backslash) in app.module

To create an component in angular-cli , run ng g component webapi.component and get all files excepting the line in app.module.ts :

import { WebapiComponent } from './components\webapi/webapi.component';

Any idea whhy the backslash appears after `./components\\' ?

It's a current bug that occurs on Windows based operating systems in conjuction with the terminal you're are using. Basically, it's not converting the path delim to unix style forward slashes. I've seen some weirdness with Git Bash and Angular-cli, so to rule out the possibility of your terminal try the same ng generate line in cmd prompt.

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