revolunet / angular-google-analytics

Google Analytics tracking for your AngularJS apps
MIT License
652 stars 179 forks source link

AnalyticsProvider.setAccount is not a function #192

Open djvs opened 7 years ago

djvs commented 7 years ago

Trying to just do the normal "config" section for AnalyticsProvider.

Followed config instructions...calling AnalyticsProvider.setAccount(...) gives this error...running debugger shows AnalyticsProvider as an empty {} object with a $get method. "setAccount" is just undefined.

Angular 1.5.8

justinsa commented 7 years ago

@djvs What error are you getting?

Do you have the module included as part of the dependencies?

Can you provide the code that isn't working? What you have provided so far is inadequate to determine what is wrong.

djvs commented 7 years ago

Hi Justin,

That code has been erased to make space for alternate code, but yes, the module was installed and loaded, and AnalyticsProvider was injected into the app config block - inspecting it with debugger in context showed an object with only a $get function. The error is triggered by attempting to do AnalyticsProvider.setAccount(...) in that same context, and is shown in the title of this github issue, I imagine the error trace is useless because it only shows where in my code the function was called..

On Jan 11, 2017 3:03 PM, "Justin Saunders" notifications@github.com wrote:

@djvs https://github.com/djvs What error are you getting?

Do you have the module included as part of the dependencies?

Can you provide the code that isn't working? What you have provided so far is inadequate to determine what is wrong.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/revolunet/angular-google-analytics/issues/192#issuecomment-271978291, or mute the thread https://github.com/notifications/unsubscribe-auth/AC0UZ5uzHkNGe0OC310GnoZa1rUbzPmDks5rRTWDgaJpZM4Lexhs .

justinsa commented 7 years ago

@djvs I cannot attempt to debug or identify the problem with what you have provided. A $get function is what a provider must expose in Angular. The fact you are seeing the $get function though implies you haven't called it in the config context. The quick start section in the README lays out exactly how to structure the Angular.config.

If you want help resolving this, you need to post code that shows how this is not working for you. If you cannot do that then we cannot assist you in resolving this.