initializeModelAdapter
since v1.1.0initializeModelAdapter(
adapter,model?,injector?):ModelAdapter
Initializes an existing model adapter for use in ng-diagram.
Prepares all nodes and edges in the adapter so they are ready for rendering by ng-diagram. Use this when providing a custom ModelAdapter implementation.
Parameters
Section titled “Parameters”adapter
Section titled “adapter”An existing ModelAdapter to initialize.
model?
Section titled “model?”Partial<Model>
Optional initial model data to seed the adapter with.
injector?
Section titled “injector?”Injector
Optional Angular Injector if not running inside an injection context.
Returns
Section titled “Returns”Example
Section titled “Example”// Basic usage with a custom adaptermodel = initializeModelAdapter(new NgRxModelAdapter(this.store));
// With initial model data to seed the adaptermodel = initializeModelAdapter(new NgRxModelAdapter(this.store), { nodes: [{ id: '1', position: { x: 0, y: 0 }, data: { label: 'Node 1' } }], edges: [],});
// With an explicit injector (outside injection context)model = initializeModelAdapter(new NgRxModelAdapter(this.store), undefined, this.injector);