Handling lifecycle when using compose from a view model

I did something like this quite a while back, and it still seems to work.

const element = here.you.create.HTMLElementFragment();
this.templatingEngine.enhance({
  element,
  bindingContext: { what: ever },
});
// grab the controller
const controller = element['au'].controller;

// later when you want to tearDown
controller.detached();
controller.unbind();
1 Like