I have my angular application stored in a variable
(initialized with:)
var app = angular.module('app', [...]);
Now, I need to access the $timeout
service.
How can I retrieve this service from it?
I am looking for something like:
var timeout = app.getService('$timeout');
or
app.something('$imeout', function($timeout) {
...
} // similar to controller() method
This is where I want to utilize it:
define([], function () { // Here I can import either my angular module 'app' or just 'angular'
return {
'some_function': function () {
$timeout(function() { ... do something ... }, 1000);
}
}
}
This service will be utilized by my controllers (using requirejs).