Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Override TypeScript ControllersperTheme

Describes how to override the TypeScript ControllersperTheme in Optimizely Configured Commerce.

Based on the theme you are in, this article provides the necessary steps to override the TypeScript Controllers.The Standard Controller can be overridden with a controller that selects the controller for the theme you are in. Then, in the init method of the "contain and delegate" controller you can get the injector:

const injector = angular.element(document.body).injector();

and then say, if theme is InsiteCustom, use the injector to get the InsiteCustom version of the controller:

this.delegateToController = injector.get("InsiteCustomController");
else
this.delegateToController = injector.get("InsiteStandardController");

In your "contain and delegate" controller you override all the standard methods and delegate the calls to the this.delegateToController methods.