GithubHelp home page GithubHelp logo

owi1972 / bpmn-js-example-angular Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bpmn-io/bpmn-js-example-angular

0.0 2.0 0.0 584 KB

An example how to integrate bpmn-js with an Angular application.

JavaScript 11.58% TypeScript 72.04% CSS 1.26% HTML 15.12%

bpmn-js-example-angular's Introduction

bpmn-js-example-angular

Build Status

An example how to integrate bpmn-js with an Angular application.

Integration Screenshot

Prerequisites

Assume you bootstrapped your application using the ng command:

ng new bpmn-js-app --defaults=true
cd bpmn-js-app

Integrating bpmn-js

Create a component similar to DiagramComponent:

import {
  AfterContentInit,
  Component,
  ElementRef,
  OnDestroy,
  ViewChild
} from '@angular/core';

/**
 * You may include a different variant of BpmnJS:
 *
 * bpmn-viewer  - displays BPMN diagrams without the ability
 *                to navigate them
 * bpmn-modeler - bootstraps a full-fledged BPMN editor
 */
import BpmnJS from 'bpmn-js/dist/bpmn-navigated-viewer.development.js';

@Component({
  selector: 'app-diagram',
  template: `<div #ref class="diagram-container"></div>`,
  styles: `
    .diagram-container {
      height: 100%;
      width: 100%;
    }
  `
})
export class DiagramComponent implements AfterContentInit, OnDestroy {

  // instantiate BpmnJS with component
  private viewer: BpmnJS = new BpmnJS();

  // retrieve DOM element reference
  @ViewChild('ref') private el: ElementRef;

  ngAfterContentInit(): void {
    // attach BpmnJS instance to DOM element
    this.viewer.attachTo(this.el.nativeElement);
  }

  ngOnDestroy(): void {
    // destroy BpmnJS instance
    this.viewer.destroy();
  }

}

Test the Example

npm install
npm run all

License

MIT

bpmn-js-example-angular's People

Contributors

dankreiger avatar nikku avatar

Watchers

 avatar  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.