This project was generated with Angular CLI version 14.2.7.
A workspace is a set of Angular applications and libraries. The angular.json file at the root level of an Angular workspace provides workspace-wide and project-specific (application or library) configuration defaults for build and development tools.
Angular also supports workspaces with multiple projects. This type of development environment is suitable for advanced users who are developing shareable libraries, and for enterprises that use a "monorepo" development style, with a single repository and global configuration for all Angular projects - https://angular.io/guide/file-structure
The --createApplication=false
parameter avoids the creation of an initial application (default value is true).
// create a workspace
ng new angularWorkspace --create-application=false --directory=angularWorkspace --interactive=false
// Creating an application in a workspace
cd angularWorkspace
ng generate application first-app --style=scss --routing=true
ng generate application second-app --style=scss --routing=true
Now, on the root angular.json
we will have:
{
...
"projects": {
"first-app": { ... },
"second-app": { ... },
}
...
}
The syntax is ng generate service
service-name
and the parameter--project
is mandatory to specify the library where to generate the service.
ng generate service services/test-service --project=first-app
ng add @angular/material --project=first-app
ng serve --project=first-app
ng serve first-app
ng serve --project=second-app
ng serve second-app
// simply change inside: `/second-app/app/app.component.html`
// instead of
<h2>Resources</h2>
// do
<h2>Resources Test second workspace (and not first)</h2>
ng build --prod --project=first-app
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The application will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.