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
<input type="text" /> | |
<div tabindex="0"></div> | |
<div tabindex="0"></div> | |
<input type="text" /> |
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
export class MapModule { | |
//create a static function with the mapConfig as a parameter | |
static forRoot(mapConfig: IMapsConfig): ModuleWithProviders { | |
return { | |
ngModule: MapModule, | |
//We provide a MapsConfig InjectionToken, which we later can use in our service to use | |
providers: [ {provide: MapsConfig, useValue: mapConfig} ] | |
}; | |
} | |
} |
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
export class MapModule { | |
//create a static function with the mapConfig as a parameter | |
static forRoot(mapConfig: IMapsConfig): ModuleWithProviders { | |
return { | |
ngModule: MapModule, | |
//We provide a MapsConfig InjectionToken, which we later can use in our service to use | |
providers: [ {provide: MapsConfig, useValue: mapConfig} ] | |
}; | |
} | |
} |
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
//Use the InjectionToken for the mapsConfig, this can be later used to inject it with DI | |
export const MapsConfig = new InjectionToken<IMapsConfig>('MAPS_CONFIG'); | |
@Injectable({ | |
providedIn: MapModule | |
}) | |
export class MapService { | |
private _key: string; | |
constructor( |
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
export interface IMapsConfig { | |
key: string; | |
} |
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
export class MapModule { | |
static forRoot(mapConfig: IMapsConfig): ModuleWithProviders { | |
return { | |
ngModule: MapModule, | |
providers: [ {provide: MapsConfig, useValue: mapConfig} ] | |
} | |
} | |
} |
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
@NgModule({ | |
imports: [ | |
MapModule.forRoot({ | |
key: 'mykeyId' | |
}) | |
], | |
}) |
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
var marker = google.maps.Marker(); |
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
<head> | |
<link rel="import" href="/path/to/some/import.html"> | |
</head> |