want to create nested component in angular 6 . Folder structure is src->app->content->1.home,2.product want create component in product. i did this am on already in folder product c:/users/admin/project/test/src/app/content/product> ng g component advisory on cmd
Getting Error as : Unexpected token / in JSON at position 1122
Angular allows us to have a different child, or nested component, which is the same component we normally use in an Angular application.
What are Angular Nested Components? The Angular framework allows us to use a component within another component and when we do so then it is called Angular Nested Components. The outside component is called the parent component and the inner component is called the child component.
Source copied from the official 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
Go to the root directory where angular-cli is there
and give the command as follows
c :/users/admin/project/test/src/app/content > ng g c product/advisory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With