创建嵌套的Component Angular 6

ved*_*vas 2 angular-cli angular

想要在角度6中创建嵌套组件.文件夹结构是src-> app-> content-> 1.home,2.product想要在产品中创建组件.我这样做已经在文件夹产品c:/ users/admin/project/test/src/app/content/product> ng g组件顾问关于cmd

获取错误:位置1122处的JSON中出现意外的令牌/

Anu*_*ara 9

源自官方angular-cli doc复制的来源

ng generate component my-new-component
ng g component my-new-component  // using the alias

// components support relative path generation
// if in the directory src/app/feature/ and you run
ng g component new-cmp
// your component will be generated in src/app/feature/new-cmp
// but if you were to run
ng g component ./newer-cmp
// your component will be generated in src/app/newer-cmp
// if in the directory src/app you can also run

    ng g component feature/new-cmp

// and your component will be generated in src/app/feature/new-cmp
Run Code Online (Sandbox Code Playgroud)


Pad*_*han 5

进入 angular-cli 所在的根目录

并给出命令如下

c :/users/admin/project/test/src/app/content > ng g c product/advisory
Run Code Online (Sandbox Code Playgroud)