Getting Started with Syncfusion Angular and SystemJS

20 Dec 20226 minutes to read

Refer to the following steps to create an angular application with SystemJS using Syncfusion Angular UI Components (Essential JS 2).

This section describes about how to create an angular application with SystemJS.

Cloning Angular Quick Start

To clone the Angular QuickStart project into a local folder, run the following commands:

git clone 
cd quickstart 
npm install

Perform following steps to use Syncfusion angular components in angular app which uses SystemJS.

NOTE: The Angular QuickStart project has been deprecated. To create new angular projects, Angular CLI is the best way.

Installing Syncfusion Grid Package

Syncfusion packages are distributed in npm as @syncfusion scoped packages. You can get all the angular syncfusion package from npm link.

Add @syncfusion/ej2-angular-grids package to the application.

npm install @syncfusion/ej2-angular-grids --save
npm i @syncfusion/ej2-angular-grids --save

Adding Grid Module

After installing the package, the component modules are available to configure into your application from the installed syncfusion package. Syncfusion Angular package provides two different types of ngModules.

Refer to Ng-Module to learn about ngModules.

Refer to the following snippet to import the button module in app.module.ts from the @syncfusion/ej2-angular-grids.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';

// Imported syncfusion Grid module from buttons package
import { GridAllModule } from '@syncfusion/ej2-angular-grids';

  declarations: [
  imports: [

    // Registering EJ2 Grid Module
  providers: [],
  bootstrap: [AppComponent]
export class AppModule { }

Adding Syncfusion Component

Add the grid component snippet in app.component.ts as follows.

import { Component, OnInit } from '@angular/core';

    selector: 'app-root',
    template: `<ejs-grid [dataSource]='data'>
                    <e-column field='OrderID' headerText='Order ID' textAlign='Right' width=90></e-column>
                    <e-column field='CustomerID' headerText='Customer ID' width=120></e-column>
                    <e-column field='Freight' headerText='Freight' textAlign='Right' format='C2' width=90></e-column>
                    <e-column field='OrderDate' headerText='Order Date' textAlign='Right' format='yMd' width=120></e-column>
export class AppComponent implements OnInit {

    public data: Object[];

    ngOnInit(): void {
        // For initializing DataSource to grid = [
              OrderID: 10248, CustomerID: 'VINET', EmployeeID: 5, OrderDate: new Date(8364186e5),
              ShipName: 'Vins et alcools Chevalier', ShipCity: 'Reims', ShipAddress: '59 rue de l Abbaye',
              ShipRegion: 'CJ', ShipPostalCode: '51100', ShipCountry: 'France', Freight: 32.38, Verified: !0
              OrderID: 10249, CustomerID: 'TOMSP', EmployeeID: 6, OrderDate: new Date(836505e6),
              ShipName: 'Toms Spezialitäten', ShipCity: 'Münster', ShipAddress: 'Luisenstr. 48',
              ShipRegion: 'CJ', ShipPostalCode: '44087', ShipCountry: 'Germany', Freight: 11.61, Verified: !1
              OrderID: 10250, CustomerID: 'HANAR', EmployeeID: 4, OrderDate: new Date(8367642e5),
              ShipName: 'Hanari Carnes', ShipCity: 'Rio de Janeiro', ShipAddress: 'Rua do Paço, 67',
              ShipRegion: 'RJ', ShipPostalCode: '05454-876', ShipCountry: 'Brazil', Freight: 65.83, Verified: !0

Adding CSS Reference

The following CSS files are available in ../node_modules/@syncfusion package. This can be referred in [src/styles.css] using following code.

@import '../node_modules/@syncfusion/ej2-grids/styles/material.css';

Configuring SystemJS

The systemJS configuration file has been placed in the project template under src/systemjs.config.js.

To add the Syncfusion angular packages refer below code snippet. Need to add required syncfusion packages in systemjs.config.js file at map section

      '@syncfusion/ej2-angular-grids':  'npm:@syncfusion/ej2-angular-grids/dist/ej2-angular-grids.umd.min.js',

Running Your Application

To run the application in the browser, use following command

npm start

See Also