File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/lib/core/compatibility Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 77 Optional ,
88 isDevMode ,
99 ElementRef ,
10+ NgZone ,
1011} from '@angular/core' ;
1112import { DOCUMENT } from '@angular/platform-browser' ;
1213import { MdError } from '../errors/error' ;
@@ -193,11 +194,16 @@ export class CompatibilityModule {
193194 } ;
194195 }
195196
196- constructor ( @Optional ( ) @Inject ( DOCUMENT ) private _document : any ) {
197+ constructor ( @Optional ( ) @Inject ( DOCUMENT ) private _document : any , ngZone : NgZone ) {
197198 if ( ! hasDoneGlobalChecks && isDevMode ( ) ) {
198- this . _checkDoctype ( ) ;
199- this . _checkTheme ( ) ;
200- hasDoneGlobalChecks = true ;
199+ ngZone . runOutsideAngular ( ( ) => {
200+ // Delay running the check to allow more time for the user's styles to load.
201+ setTimeout ( ( ) => {
202+ this . _checkDoctype ( ) ;
203+ this . _checkTheme ( ) ;
204+ hasDoneGlobalChecks = true ;
205+ } , 5000 ) ;
206+ } ) ;
201207 }
202208 }
203209
You can’t perform that action at this time.
0 commit comments