Closed dportabella closed 8 years ago
It's some kind of convention (see below some references). The name of the file states it is a service: products.service.js
. In the code, you can tell if is a service or an instance by the capitalization...
// https://github.com/amejiarosario/meanshop/blob/master/client/app/products/products.controller.js#L8
var products = Product.query();
You can tell the service always starts with uppercase Product
while the instance starts with lower case product
.
If you take a look at the Angular source code itself you will notice they don't use Service
suffix. Neither on popular AngularJS guides like this one.
See:
I found several cases using the Service
suffix in the popular AngularJS you mention:
var hero = avengerService.find(vm.heroSearch);
return avengersService.getAvengers()
return creditService.isOrderTotalOk(vm.total)
movieService.getMovies().then(function(response) {
vm.movies = moviesPrepService.movies;
vm.refresh = sessionDataService.refresh;
In products.service.js you create a service named 'Product'. Why? it is a service, not a product. This name is totally misleading. It should be called ProductService.
https://github.com/amejiarosario/meanshop/blob/master/client/app/products/products.service.js