Eno
Eno

Reputation: 10860

How to use Angular's $log service from inside my own services/providers?

I got error when I injected it in the normal way - so is it possible to use $log inside my own services and/or providers ?

Upvotes: 0

Views: 323

Answers (1)

Mark Pieszak - Trilon.io
Mark Pieszak - Trilon.io

Reputation: 67219

Of course.

Are you sure you're injecting it correctly?

yourApp.service('myService', ['$log', function ($log) {
    $log.log('Hi console!');
}]);

Upvotes: 2

Related Questions