Skip to content

Commit

Permalink
Merge pull request #815 from HiP-App/iss-hipcms-1041
Browse files Browse the repository at this point in the history
implimented google api maps key
  • Loading branch information
rajatkhanna1994 authored Jun 18, 2018
2 parents 2d7be7d + 8b600eb commit d6cf75c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
13 changes: 13 additions & 0 deletions app/mobile-content/maps-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ConfigService } from './../config.service';
import {Injectable} from '@angular/core';
import {LazyMapsAPILoaderConfigLiteral} from '@agm/core';

@Injectable()
export class MapsConfig implements LazyMapsAPILoaderConfigLiteral {
public apiKey: string;
public libraries: string[];
constructor(config: ConfigService) {
this.apiKey = config.get('googleMapsApiKey');
this.libraries = ['places'];
}
}
16 changes: 12 additions & 4 deletions app/mobile-content/mobile-content.module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ConfigService } from './../config.service';
import { RatingTableComponent } from './shared/star-rating-table/star-rating-table.component';
import { AgmCoreModule } from '@agm/core';
import { AgmCoreModule, LAZY_MAPS_API_CONFIG } from '@agm/core';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
Expand Down Expand Up @@ -64,11 +65,12 @@ import { ChangeHistoryDetailedComponent } from './shared/change-history/change-h

import { ClickStopPropagationDirective } from '../shared/directives/clickStopPropagation.directive';

// Used for fetching mapsApiKey
import { MapsConfig } from './maps-config';

@NgModule({
imports: [
AgmCoreModule.forRoot({
apiKey: 'AIzaSyAGpVhncb65XwBrV_yWK8RHWcydDsLWCH4',
libraries: ['places']
}),
CommonModule,
FormsModule,
Expand Down Expand Up @@ -153,6 +155,11 @@ import { ClickStopPropagationDirective } from '../shared/directives/clickStopPro
ChangeHistoryDetailedComponent
],
providers: [
{
provide: LAZY_MAPS_API_CONFIG,
useClass: MapsConfig,
deps: [ConfigService]
},
AchievementApiService,
AchievementService,
ExhibitService,
Expand All @@ -166,4 +173,5 @@ import { ClickStopPropagationDirective } from '../shared/directives/clickStopPro
ThumbnailService
]
})
export class MobileContentModule {}
export class MobileContentModule {
}
4 changes: 4 additions & 0 deletions typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module "*.json" {
const value: any;
export default value;
}

0 comments on commit d6cf75c

Please sign in to comment.