Write your own Controller

Reuse functionality across components by writing it as a Controller

This page is a work in progress. It will be updated as the software evolves.

A Controller must follow the interface of UmbController, to ease the implementation you can base your class on the UmbController:

import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';

class MyController extends UmbControllerBase {
	
	hostConnected() {
		super.hostConnected();
		// Your code when the Host element is connected.
	}
	hostDisconnected() {
		super.hostDisconnected();
		// Your code when the Host element is disconnected.
	}
	destroy() {
		super.destroy();
		// Your code for when this controller gets destroyed.
	}
}

Last updated