1

I have to create two different themes for an angular application. Each theme needs to be loaded based on a property from an API call. I would like to create two HTML files that will use the same .ts code, because the functionality will remain the same.

Whats is the best approach to have this implemented. Right now this implementation is made using ngSwitch inside .html

enter image description here

2
  • does this solve ur question?stackoverflow.com/questions/46235412/… Commented Nov 26, 2021 at 7:00
  • Please provide enough code so others can better understand or reproduce the problem. Commented Nov 30, 2021 at 12:04

1 Answer 1

0

Create two different presentational components. Pass data to those components from the parent component. Switch between components from using ngIf.

<presentation-component-one *ngIf="isThemeOne" [data]="data"></presentation-component-one>
<presentation-component-two *ngIf="isThemeTwo" [data]="data"></presentation-component-two>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.