Last active
January 20, 2019 01:29
-
-
Save LayZeeDK/0dc28b2b23884778d0ae96f014b705f2 to your computer and use it in GitHub Desktop.
Modern injection token with value factory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { InjectionToken } from '@angular/core'; | |
export const isInternetExplorer11Token: InjectionToken<boolean> = | |
new InjectionToken('Internet Explorer 11 flag', { | |
factory: (): boolean => | |
/Trident\/7\.0.+rv:11\.0/.test(navigator.userAgent), | |
providedIn: 'root', | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment