Reputation: 77
I am trying to create an angular component in visual studio code. By default, my angular components are in ClientApp. I have some default components in ClientApp. When I tried to add a new angular component in the components folder in ClientApp I get an error.
When I enter "ng g component vehicle-form" I have an error. It says " Invalid path: "vehicle-form" cannot be above the "ClientApp\app" directory." However, my angular components are in the app folder located within the app folder of Client App.
PS C:\Users\Sushi\vega> cd ClientApp
PS C:\Users\Sushi\vega\ClientApp> cd app
PS C:\Users\Sushi\vega\ClientApp\app> cd components
PS C:\Users\Sushi\vega\ClientApp\app\components> ng g component vehicle-form
Invalid path: "vehicle-form" cannot be above the "ClientApp\app" directory
My .angular-cli.json configuration is as listed below.
"apps": [
{
"root": "ClientApp",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
Upvotes: 0
Views: 6543
Reputation: 1
try to change
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
then ng g c vehicle-form
Upvotes: 0
Reputation: 119
If you want to create a component from angular cli then just run the command
ng g component vehicle-form
From your root directory i.e
PS C:\Users\Sushi\vega\ClientApp> ng g component vehicle-form
Upvotes: 1