From a0b5546111a2d28e45e1bc031c0a1b1edc109c23 Mon Sep 17 00:00:00 2001 From: kian Date: Tue, 15 Jun 2021 18:17:31 +0430 Subject: [PATCH] fix(material/theme): unselected theme picker Fix unselected theme picker when localStorage is empty. Fixes #204 --- .../src/app/shared/theme-picker/theme-picker.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/material.angular.io/src/app/shared/theme-picker/theme-picker.ts b/material.angular.io/src/app/shared/theme-picker/theme-picker.ts index b8f3927e529f..f161073e64c6 100644 --- a/material.angular.io/src/app/shared/theme-picker/theme-picker.ts +++ b/material.angular.io/src/app/shared/theme-picker/theme-picker.ts @@ -75,6 +75,12 @@ export class ThemePicker implements OnInit, OnDestroy { const themeName = this._themeStorage.getStoredThemeName(); if (themeName) { this.selectTheme(themeName); + } else { + this.themes.find(themes => { + if (themes.isDefault === true) { + this.selectTheme(themes.name); + } + }); } }