想要在角度6中创建嵌套组件。文件夹结构是src-> app-> content-> 1.home,2.product 想要在产品中创建组件。 我已经在文件夹产品c中做了这个:/ users / admin / project / test / src / app / content / product>关于cmd的ng g组件咨询
将错误视为:位置1122处的JSON中出现意外的令牌/
答案 0 :(得分:8)
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
答案 1 :(得分:2)
转到angular-cli所在的根目录
并按如下方式给出命令
c :/users/admin/project/test/src/app/content > ng g c product/advisory