0

I have to build an application which supports dynamic template rendering. For example, consider following templates for landing page.

theme1/home.html

<div>Welcome ${name}!</div>

theme2/home.html

<div>Welcome ${name}!</div>
<p>Sed ut perspiciatis unde omnis iste natus  inventore</p>

If user 'A' logs in, theme1/home.html should be rendered whereas for user 'B', theme2/home.html should be rendered.

I have to maintain 10-15 themes in my application and particular theme should be rendered based on logged in user dynamically.

If I make the templateUrl dynamic by appending the variable path to filename as follows, its not working.

templateUrl: pathToThemeFolder + '/home.html'

Please suggest how to achieve this requirement?

Kalyan
  • 294
  • 3
  • 10

2 Answers2

0

To Implement such a dynamic scenario you need to save theme detail on backend side with the user.

API by which you are checking for a valid user, get theme details as well in the response of API and based on it you can load the theme.

Mohit Saxena
  • 1,439
  • 1
  • 12
  • 21
0

dynamic scenario needs template url ( use API services) Httpclientservice directive and import data(themes) and export themes of based on API key