Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Commit

Permalink
fix(Analytics): add Analytics inside providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Mukuna Ciowela committed Apr 12, 2019
1 parent 8f24268 commit 4cd13c8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { HashLocationStrategy, LocationStrategy } from '@angular/common';

import { Analytics } from './demos/shared/analytics';

import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { NgBoostedModule } from '../../dist';

Expand Down Expand Up @@ -191,7 +193,7 @@ import { Globals } from './global';
DocOToggle,
CodeBox
],
providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}, Globals],
providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}, Globals, Analytics],
bootstrap: [ AppComponent ]
})
export class AppModule { }
4 changes: 2 additions & 2 deletions docs/app/demos/shared/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ declare const ga: any;

/**
* Simple Google Analytics service. Note that all its methods don't do anything unless the app
* is deployed on http://ng-boosted.orange.com. This avoids sending events and page views during development.
* is deployed on https://ng-boosted.orange.com. This avoids sending events and page views during development.
*/
@Injectable()
export class Analytics {
private _enabled: boolean;

constructor(private _location: Location, private _router: Router) {
this._enabled = window.location.href.indexOf('http://ng-boosted.orange.com') >= 0;
this._enabled = window.location.href.indexOf('https://ng-boosted.orange.com') >= 0;
}

/**
Expand Down

0 comments on commit 4cd13c8

Please sign in to comment.