Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

How do I make sub-services into a service folder #14

Open
festum opened this issue Aug 28, 2013 · 3 comments
Open

How do I make sub-services into a service folder #14

festum opened this issue Aug 28, 2013 · 3 comments

Comments

@festum
Copy link

festum commented Aug 28, 2013

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!

@finico
Copy link

finico commented Mar 16, 2014

@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);
});

@destiny1020
Copy link

@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 !

@SaidTayebi
Copy link

@destiny1020 What kind of dependencies you are talking about ? Angular services, filters, directives or JavaScript files ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants