Yes. you can. (to an extent)
look here for class/style switching in angular2: coryrylan.com/blog/introduction-to-angular-2-ngcl…
what you would do is this:
<body [ngclass]=SLECTEDCLASS>
<button class="myclass">press me!</button> </body>
in the CSS (i use less in my project) you would have your "themes" as such:
theme1 {
.myclass {
color:red
}
}
theme2 {
.myclass {
color:blue
}
}
in your JS code, you would have logic to change "SLECTEDCLASS" between theme1, and theme2
The drawback (and perhaps limitation) is that the expectation between the layouts in different themes would need to remain the same. i.e: if one template is:
<div class="a">
<span class="b">
</div>
<span class="3" />
you would run into issues if you have below in the other:
<span ="b>
<div="a">
<span="3">
</div>