Getting started with Angular Image editor component

11 Jul 20244 minutes to read

This section explains how to create and demonstrate the basic usage of the Angular Image Editor module.

To get started quickly with angular Image Editor component using angular CLI, you can check the video below.

Dependencies

The list of dependencies required to use the Image Editor module in your application is given below:

|-- @syncfusion/ej2-angular-image-editor
    |-- @syncfusion/ej2-angular-base
    |-- @syncfusion/ej2-base
     -- @syncfusion/ej2-data
    |-- @syncfusion/ej2-buttons
     -- @syncfusion/ej2-lists
    |-- @syncfusion/ej2-image-editor
    |-- @syncfusion/ej2-dropdowns
    |-- @syncfusion/ej2-inputs
    |-- @syncfusion/ej2-navigations
    |-- @syncfusion/ej2-popups
    |-- @syncfusion/ej2-splitbuttons

Setup Angular environment

You can use Angular CLI to setup your Angular applications. To install Angular CLI use the following command.

npm install -g @angular/cli

Create an Angular application

Start a new Angular application using below Angular CLI command.

ng new my-app
cd my-app

Installing Syncfusion Image Editor package

To install Image Editor package, use the following command.

npm install @syncfusion/ej2-angular-image-editor --save

The above package installs Image Editor dependencies which
are required to render the component in the Angular environment.

Adding Syncfusion Image Editor component

Modify the template in app.component.ts file to render the Angular Image Editor component.

import { ImageEditorModule } from '@syncfusion/ej2-angular-image-editor'
import { Component } from '@angular/core';

@Component({
imports: [        
        ImageEditorModule
    ],
    standalone: true,
    selector: 'app-root',
    template: `<!-- To render Image Editor. -->
              <div id="wrapperDiv" style="width:550px;height:350px;">
               <ejs-imageeditor></ejs-imageeditor>
              </div>`
})
export class AppComponent  { }

Adding CSS reference

Add Angular Image Editor component’s styles as given below in style.css.

@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-lists/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-dropdowns/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-image-editor/styles/material.css";

Running the application

Run the application in the browser using the following command:

ng serve

The following example shows a basic Image Editor component.

import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { ImageEditorModule } from '@syncfusion/ej2-angular-image-editor'
import { enableRipple } from '@syncfusion/ej2-base'



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

@Component({
imports: [
        
        ImageEditorModule
    ],


standalone: true,
    selector: 'app-root',
    template: `<div class="e-section-control">
              <!-- To render Image Editor. -->
              <div id="wrapperDiv" style="width:550px;height:350px;">
                <ejs-imageeditor></ejs-imageeditor>
              </div>
              </div>`
})

export class AppComponent {

}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));

You can also explore our Angular Image Editor example that shows how to render the Image Editor in Angular.