@jolly wrote:
Using Angulartics2 for Google Analytics and Piwik ( matomo ). If I use only one provider, they work great, but having syntax problem when trying to use both. In app.module.ts…
import {Angulartics2Module, Angulartics2GoogleAnalytics, Angulartics2Piwik} from ‘angulartics2’;
…and later for use in the module:@NgModule({
imports: [
BrowserModule,
AppRoutingModule,
LayoutModule,
StaticModule,
Angulartics2Module.forRoot([ Angulartics2GoogleAnalytics, Angulartics2Piwik ]),
MetaModule.forRoot(metaConfig)
],
declarations: [
App
],
bootstrap: [ App ],
providers: [ ENV_PROVIDERS, APP_PROVIDERS ],
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
…
In app.routes.ts, here is the main code:import { NgModule } from ‘@angular/core’;
import { Routes, RouterModule } from ‘@angular/router’;
import { NoContent } from ‘./no-content’;
import { Angulartics2GoogleAnalytics } from ‘angulartics2’;
import { Angulartics2Piwik } from “angulartics2”;import { DataResolver } from ‘./app.resolver’;
export const ROUTES: Routes = [
{ path: ‘’, loadChildren: () => System.import(’./home/home.module’).then(mod => mod.HomeModule), pathMatch: ‘full’ },
{ …other paths… },
{ path: ‘**’, component: NoContent }
];@NgModule({
imports: [RouterModule.forRoot(ROUTES)],
exports: [RouterModule]
})export class AppRoutingModule
{
// constructor(angulartics2GoogleAnalytics: Angulartics2GoogleAnalytics) {}
constructor(angulartics2Piwik: Angulartics2Piwik) {}
}
I get a “multiple constructors not allowed” if I uncomment both of the constructors in the export class AppRoutingModule…I want to ensure that I am using both providers, but can’t seem to figure out how to get both in the export.
Thanks in advance.
Posts: 1
Participants: 1