This file contains hidden or 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 { HttpClient } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class ModernSingletonService { | |
constructor( | |
private http: HttpClient, | |
) {} |
This file contains hidden or 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 { HttpClient } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
import { ModernModule } from './modern.module'; | |
@Injectable({ | |
providedIn: ModernModule, | |
}) | |
export class ModernSingletonService { | |
constructor( |
This file contains hidden or 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 { HttpClient } from '@angular/common/http'; | |
import { Injectable, Optional, SkipSelf } from '@angular/core'; | |
import { ModernModule } from './modern.module'; | |
@Injectable({ | |
deps: [ | |
[new Optional(), new SkipSelf(), ModernSingletonService], | |
HttpClient, | |
], |
This file contains hidden or 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 { NgModule } from '@angular/core'; | |
import { isInternetExplorer11Token } from './is-internet-explorer-11.token'; | |
@NgModule({ | |
providers: [ | |
{ | |
provide: isInternetExplorer11Token, | |
useFactory: (): boolean => | |
/Trident\/7\.0.+rv:11\.0/.test(navigator.userAgent), |
This file contains hidden or 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', | |
}); |
This file contains hidden or 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 { inject, InjectionToken } from '@angular/core'; | |
import { userAgentToken } from './user-agent.token'; | |
export const isInternetExplorer11Token: InjectionToken<boolean> = | |
new InjectionToken('Internet Explorer 11 flag', { | |
factory: (): boolean => | |
/Trident\/7\.0.+rv:11\.0/.test(inject(userAgentToken)), | |
providedIn: 'root', | |
}); |
This file contains hidden or 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 { Component, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'pre-ivy-app', | |
template: ` | |
<h1> | |
Hello, {{name}}! | |
</h1> | |
`, | |
}) |
This file contains hidden or 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 { Component, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'ivy-app', | |
template: ` | |
<h1> | |
Hello, {{name}}! | |
</h1> | |
`, | |
}) |