I think you wan't:
var motoAdsApp = angular.module("motoAdsApp", []);
motoAdsApp.controller('AirportControllers', *['*$scope', '$http',
'AirportService', function ($scope, $http, AirportService) {
AirportService.getData().then(function(data) {
$scope.agents = data;
});
}*]*);
In your first example so you correctly instruct angular about your
dependencies.
Doing that should bring your unknown provider error back.
I am guessing the problem after that is the AirportService (It can't find
an AirportServiceProvider)... Either you didn't define that at all, or you
defined it in a different module which you forgot to depend on. Or finally
you forgot to include the file it was defined in.
Of the two examples you have, the second one gives you the error in
question as angular can automatically detect the dependencies when you
don't use [] notation. So here it actually tries to inject $scope, $http
and AirportService. In the first example you don't see the same error as it
doesn't try to inject anything, as you have told it not to. But as Sander
points out, that means your controller fails on the very first line instead.
Be aware that minification will break your application in the second case
though, unless you use something like 'ng-annotate" (which I would not
recommend for beginners).
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.