GrapesJS integrates cleanly with Angular using an injectable service pattern. Because GrapesJS is a vanilla JavaScript library with no framework dependencies, it works with any Angular version — from AngularJS-era patterns to Angular 17+ standalone components. GJS.Market provides Angular-compatible plugins so you can extend your editor without rebuilding anything from scratch.
Browse Angular-compatible plugins →Step 1 — Create an Angular Service Wrapper
Encapsulate GrapesJS in an injectable service to manage lifecycle and expose the editor instance across your application:
// grapesjs.service.ts
import { Injectable, ElementRef } from '@angular/core';
import grapesjs from 'grapesjs';
import type { Editor } from 'grapesjs';
@Injectable({ providedIn: 'root' })
export class GrapesJSService {
private editor: Editor | null = null;
init(container: ElementRef): Editor {
this.editor = grapesjs.init({
container: container.nativeElement,
fromElement: false,
height: '100vh',
storageManager: false,
});
return this.editor;
}
destroy(): void {
this.editor?.destroy();
this.editor = null;
}
}Step 2 — Use the Service in a Component
Inject the service, attach the container ref, and manage the editor lifecycle via Angular hooks:
// editor.component.ts
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { GrapesJSService } from './grapesjs.service';
@Component({
selector: 'app-editor',
template: '<div #editorContainer style="height:100vh"></div>',
})
export class EditorComponent implements OnInit, OnDestroy {
@ViewChild('editorContainer') container!: ElementRef;
constructor(private gjsService: GrapesJSService) {}
ngOnInit(): void { this.gjsService.init(this.container); }
ngOnDestroy(): void { this.gjsService.destroy(); }
}Angular-Compatible Plugins
GrapesJS Blocks Basic
Essential drag-and-drop blocks for any Angular project
Storage REST API
Persist editor state to any Angular backend via REST
Style Manager Pro
Advanced CSS controls compatible with Angular apps
Export Plugin
Export HTML/CSS output from within Angular services
Known Issues & Workarounds
Change Detection (use NgZone)
GrapesJS fires events outside Angular's zone. Wrap editor event callbacks inside NgZone.run(() => { ... }) to trigger Angular change detection correctly.
SSR (disable on server)
GrapesJS requires the browser DOM. When using Angular Universal (SSR), guard your GrapesJS initialisation with isPlatformBrowser(platformId) to prevent server-side errors.
DOM timing (use AfterViewInit)
Use ngAfterViewInit instead of ngOnInit when accessing the ViewChild container. ngOnInit runs before the view is fully rendered, so the container ref will be undefined.
Frequently Asked Questions
Community Resources
Related Guides
Extend your Angular editor with GJS.Market plugins
Browse Angular-compatible plugins and starters — ship your visual editor faster.
Browse Angular-compatible plugins →