I\'m building an Angular application using Angular Material. One of the first steps in the application is that the user logs in. Next, the system loads from the backend the
The following worked for me, all credit to Guilhermecvm, however I'll add the code from the Github issue in case google brings anyone else here
angular.module('app')
.config(['$mdThemingProvider', '$provide', function($mdThemingProvider, $provide) {
$mdThemingProvider.generateThemesOnDemand(true);
$provide.value('themeProvider', $mdThemingProvider);
}])
.controller('AppController', ['themeProvider', '$mdTheming', function(themeProvider, $mdTheming) {
//create new theme
themeProvider.theme('default')
.primaryPalette('pink')
.accentPalette('orange')
.backgroundPalette('yellow');
//reload the theme
$mdTheming.generateTheme('default');
//optional - set the default to this new theme
themeProvider.setDefaultTheme('default');
}]);
To avoid 'attempted to use unregistered theme' warnings, the theme should be added to the mdTheming internal list of themes
var theme = themeProvider.theme...
$mdTheming.THEMES[themeName] = theme;