$timeout not defined error in AngularJS app
You did not inject $timeout
. It should be as follows.
app.factory('Position', ['$timeout', function($timeout) {
...
}]);
Declaration this way ensures that services are correctly identified when your JavaScript code gets minified. For further information on how this helps minification, see A Note on Minification and Declaring AngularJS Modules For Minification
If minification is not in your plans (e.g for quick test), you can simply go with
app.factory('Position', function($timeout) {
...
});