Giter Club home page Giter Club logo

ng-conf-2020-workshop's Introduction

Building Better, Scalable Enterprise Angular Applications

In this workshop, we will start from zero (no repo) and we will finish with an Angular application that consumes data from an API. As a prerequisite you need:

  1. Node.js
  2. Angular CLI npm i -g @angular/cli
  3. Ignite UI CLI Schematics npm i -g @igniteui/angular-schematics
  4. Visual Studio Code

From this point onwards we start the workshop. Steps we will take in this workshop.

  • repository setup
  • front-end angular repository
  • back-end setup (node.js in same repo)
  • SSR
  • data setup (back-end)
  • setup up data services (front-end)
  • setup up UI fast with reusable UI components (Ignite UI for Angular)
  • data transformations – pipes
  • Setting up services for cross-component communications
  • unit testing – optional if time allows
  • deployment – optional if time allows

Repo setup

To start with our project, we will setup a new repository with the igniteui-cli.

ng new --collection=@igniteui/angular-schematics

And then we follow the wizard by choosing the Angular framework and the Ignite UI for Angular project template. Choose custom styles.

Let's see how fast the application renders using the Chrome LightHouse extension (dev tools).

[SSR] Back-end

We will kill two birds with one stone in this step. We will add SSR (server-side rendering) and a node express server with API endpoints.

ng add @nguniversal/express-engine

Then copy facebook-js-sdk to tsconfig.server.json.

Let's run it to test:

npm run dev:ssr

Let's add server transfer cache.

ServerTransferStateModule to server.module imports.
TransferHttpCacheModule to app.module imports.

Back-end cont.

Let's first setup some oData. For this we will need some fetch API on our express server.

npm i node-fetch

Let's setup the endpoints for oData orders now.

In addition, we will generate some data on the server using faker.

npm i faker

Front-end

Let's setup data services for the oData endpoints on our server.

ng g s /services/orders

Let's create a communication service for success, error and other messages.

ng g s services/event-bus

Let's setup a test component that consumes the oData service and displays the data in a table view.

ng g c orders-v1 --module=app.module.ts

Let's setup a view with Ignite UI for Angular Grid component.

ng g @igniteui/angular-schematics:c

Let's optimize the css size of the application.

observe the size diff

Let's add a chart view to our application.

ng g @igniteui/angular-schematics:c

Let's add some stuff to server.shim.

Add the chart IgxLegendModule and then introduce <igx-legend>

Create a new customers view bound to the oData customers service. The view contains a customers-grid component, and the chart we already added to the project.

Let's refactor the chart into a separate component with just the chart and the legend. We will still control the chart type from the parent view.

The chart and the grid will be part of the new customers component and will interact together.

ng-conf-2020-workshop's People

Contributors

kdinev avatar damyanpetev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.