Angular Render (experimental)

Rete.js plugin

import { AngularRenderPlugin } from 'rete-angular-render-plugin';

editor.use(AngularRenderPlugin);

Import ReteModule

import { ReteModule } from 'rete-angular-render-plugin';

@NgModule({
  imports: [ReteModule]
})
export class AppModule {}

Examples

Control

import { AngularControl } from 'rete-angular-render-plugin';

export class NumControl extends Control implements AngularControl {
  component: Type<ControlComponent>
  props: {[key: string]: unknown}
  
  constructor(key) {
    super(key);
    
    this.component = ControlComponent;
    this.props = // key-value
// ...

Custom node

Extend node component

import { NodeComponent, NodeService } from 'rete-angular-render-plugin';

@Component({
  templateUrl: './node.component.html', // copy template from src/node
  styleUrls: ['./node.component.sass'], // copy styles from src/node
  providers: [NodeService]
})
export class MyNodeComponent extends NodeComponent {
  constructor(protected service: NodeService) {
    super(service);
  }
}

Add component to entryComponents of your module

@NgModule({
  entryComponents: [MyNodeComponent]
})
export class AppModule {}

Custom component for all nodes

editor.use(AngularRenderPlugin, { component: MyNodeComponent });

Custom component for specific node

import { Component } from 'rete';
import { AngularComponent, AngularComponentData } from 'rete-angular-render-plugin';

export class AddComponent extends Component implements AngularComponent {
  data: AngularComponentData;

  constructor() {
    super('Add');
    this.data.render = 'angular';
    this.data.component = MyNodeComponent;
  }
// ...