How do I make sub-services into a service folder
Hello Tom,
I'm currently using your seed as my project starter and happy with that but I have a problem- the services and directives didn't split into folders and I've tried to do it but failed.
hope you could give me some help. thanks!
@Festum I do it like this:
services/taskStorageSvc.js
define([], function () {
return function () {
return {
/**
* @return {Object}
*/
get: function () {
return //code
},
/**
* @param {Object} task
*/
put: function (task) {
//code
}
}
}
});
services.js
define([
'angular',
'services/taskStorageSvc'
], function (angular, taskStorageSvc) {
return angular.module('dothis.services', [])
.factory('taskStorage', taskStorageSvc);
});
@finico Hello, your answer helps, but I have another problem, could you please help me out ?
I want to pass a dependency into the sub-service, for example:
define([], function (**DEPENDENCY_HERE**) {
return function () {
return {
/**
* @return {Object}
*/
get: function () {
return //code
},
/**
* @param {Object} task
*/
put: function (task) {
//code
}
}
}
});
How can I do such kind of thing ? Many thanks in advance !
@destiny1020 What kind of dependencies you are talking about ? Angular services, filters, directives or JavaScript files ?