我跟着上的指示自述的Angulartics2为谷歌Analytics(分析):
app.module.ts:
import { Angulartics2Module } from 'angulartics2';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
...
imports: [Angulartics2Module.forRoot([Angulartics2GoogleAnalytics])
app.component.ts
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
...
constructor(
angulartics2GoogleAnalytics: Angulartics2GoogleAnalytics
) {
angulartics2GoogleAnalytics.startTracking();
}
angulartics2GoogleAnalytics.startTracking()虽然引发错误:Angulartics2:startTracking()不上型'Angulartics2GoogleAnalytics'存在 。
谁能告诉我为什么? 我使用的角度5.2.8。