jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 401 forks source link

Implementing factory codes for angular #477

Closed ryvan-js closed 7 years ago

ryvan-js commented 7 years ago

Hello there , where and how to implement factory codes for modules?

For example:

angular.module('nutritionApp').factory('$nutrition', ['$resource', function ($resource) {
  'use strict';

  return {
    desserts: $resource('https://infinite-earth-4803.herokuapp.com/nutrition/desserts/:id')
  };
}]);

thanks

jadjoubran commented 7 years ago

Hi @ryvan-js Using this starter, you could generate a service, which is very similar to a factory Feel free to replace all the services you find here with a factory and rename the folder and fix the index.module.js