/angularCore

Use the Angular CLI to quickstart our app and then build components, templates, routes, forms, and use ajax in Angular. Nrwl Nx

Primary LanguageTypeScript

AngularCoreWorkshop

This project was generated using Nx.

🔎 Nx is a set of Extensible Dev Tools for Monorepos.

Quick Start & Documentation

Nx Documentation

10-minute video showing all Nx features

Interactive Tutorial

Adding capabilities to your workspace

Nx supports many plugins which add capabilities for developing different types of applications and different tools.

These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well.

Below are some plugins which you can add to your workspace:

  • Angular
    • ng add @nrwl/angular
  • React
    • ng add @nrwl/react
  • Web (no framework frontends)
    • ng add @nrwl/web
  • Nest
    • ng add @nrwl/nest
  • Express
    • ng add @nrwl/express
  • Node
    • ng add @nrwl/node

Generate an application

Run ng g @nrwl/angular:app my-app to generate an application.

You can use any of the plugins above to generate applications as well.

When using Nx, you can create multiple applications and libraries in the same workspace.

Generate a library

Run ng g @nrwl/angular:lib my-lib to generate a library.

You can also use any of the plugins above to generate libraries as well.

Libraries are sharable across libraries and applications. They can be imported from @angular-core-workshop/mylib.

Development server

Run ng serve my-app for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng g component my-component --project=my-app to generate a new component.

Build

Run ng build my-app to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test my-app to execute the unit tests via Jest.

Run nx affected:test to execute the unit tests affected by a change.

Running end-to-end tests

Run ng e2e my-app to execute the end-to-end tests via Cypress.

Run nx affected:e2e to execute the end-to-end tests affected by a change.

Understand your workspace

Run nx dep-graph to see a diagram of the dependencies of your projects.

Further help

Visit the Nx Documentation to learn more.

Commands to Generate Project

  • Create the workspace

npx create-nx-workspace angular-core-workshop --preset=empty --cli=angular --npmScope=workshop

  • Configure default preprocessor

ng config schematics.@nrwl/schematics:component.styleext scss

  • Add Nrwl Angular Schematics

ng add @nrwl/angular

  • Generate the application

ng g @nrwl/angular:application dashboard --routing -p=app --style=scss --d

ng g app dashboard --routing -p=app --style=scss --d

  • Adding angular material

ng add @angular/material

  • Create material module like a lib

ng g lib material

  • Create core-data for services and common components

ng g lib core-data

  • Create ui components like a lib

ng g lib ui-login -p=ui

ng g lib ui-toolbar -p=ui

-- Create home

ng g m home --routing

ng g c home

-- Create projects

ng g m projects --routing

ng g c projects

-- Create customers

ng g m customers --routing

ng g c customers

-- Create Login Component in ui-login ib

ng g c login --project=ui-login

-- Create projects service and interface

ng g s projects/projects --project=core-data

ng g i projects/project --project=core-data

-- Install server dependencies

npm i --save-dev concurrently json-server jsonwebtoken

"server:all": "concurrently \"npm run server\" \"ng serve\" \"npm run server:auth\"", "server:auth": "node server/server.js",