diff --git a/angular-appinsights.js b/angular-appinsights.js index c9ca622..f569d3f 100644 --- a/angular-appinsights.js +++ b/angular-appinsights.js @@ -17,7 +17,7 @@ if (appInsights && appId && appInsights.start) { appInsights.start(appId); - } + } if (appInsights && appId && !appInsights.start) { appInsights=appInsights({ instrumentationKey: appId }); @@ -28,10 +28,10 @@ function Insights () { var _logEvent = function (event, properties, property) { - + if (appInsights && _appId && appInsights.logEvent) { appInsights.logEvent(event, properties, property); - } + } if (appInsights && _appId && appInsights.trackEvent){ appInsights.trackEvent(event, properties, property); } @@ -39,7 +39,7 @@ }, _logPageView = function (page) { - + if (appInsights && _appId && appInsights.logPageView) { appInsights.logPageView(page); } @@ -63,7 +63,7 @@ }) - .run(function($rootScope, $route, $location, insights) { + .run(['$rootScope', '$route', '$location', 'insights', function ($rootScope, $route, $location, insights) { $rootScope.$on('$locationChangeSuccess', function() { var pagePath; try { @@ -74,6 +74,6 @@ insights.logPageView(pagePath); } }); - }); + }]); }());