I am in the process of upgrading my company's AngularJS project to Angular 8 using ngUpgrade. This has resulted in a hybrid application with components from both AngularJS and Angular. Additionally, I am utilizing an angular material template that includes SCSS files for both frameworks.
My current challenge is to apply the AngularJS theme only to AngularJS components and the Angular theme only to Angular components, even when they are nested within each other.
I have been trying to find a solution to switch between two global CSS styles based on the presence of specific classes without resorting to lazy loading CSS.
Imagine my app code structure looks like this:
<div class="theme-1">
<div>Some stuff that should get theme 1 CSS</div>
<div class="theme-2">
<div>Some stuff that need ONLY theme 2 CSS</div>
<div>without theme 1 CSS</div>
<div class="theme-1">
<div>Switching back to theme 1</div>
</div>
</div>
</div>
I am looking for a way to dynamically switch between themes when the class theme-1
or theme-2
is present.