We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Programmatically change themein Angular 4

Thread ID:





132178 Aug 18,2017 06:08 AM UTC Aug 18,2017 11:22 AM UTC Angular 1
Tags: General
Asked On August 18, 2017 06:08 AM UTC


How can I programmatically change Theme in Angular 4?

Subha Shree Ramanathan [Syncfusion]
Replied On August 18, 2017 11:22 AM UTC

Hi Me, 

Thanks for contacting Syncfusion Support. 

Based on theme selection, we can dynamically replace the corresponding theme file (ej.web.all.min.css) referred in index.html file. Refer to the below code snippet to change the theme. 


  updateLinkTag(theme) { 
    this.links = jQuery(document.head || document.getElementsByTagName('head')[0]).find("link"); 
    for (let i = 0; i < this.links.length; i++) { 
      if (this.links[i].rel='nofollow' href.indexOf("ej.web.all.min.css") != -1) { 
        this.links[i].rel='nofollow' href = "node_modules/syncfusion-javascript/Content/ej/web/" + theme + "/ej.web.all.min.css"; 

Here we rendered the ejDropDownList to list the needed themes. While selecting the theme in dropdownlist, we changed the theme in index.html file. 


<div class="dropdownclass"> 
        <input id="dropdown" ej-dropdownlist [dataSource]="data" [fields]="fieldsvalues" [(value)]="value" (select)="selectlist($event)" [selectedIndex]=1 /> 

For your convenience we prepared the sample to achieve the requirement. 

Please let us know if you need further assistance on this. 

Subha Shree D.R                                                                     


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon