mgechev / angularjs-style-guide

📚 Community-driven set of best practices for AngularJS application development

Home Page:https://mgechev.github.io/angularjs-style-guide/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please clarify the wording

agnislav opened this issue · comments

Hi guys,

I'm updating a russian translation and bumped into a question with the following sentence.

Services representing the domain preferably a service instead of a factory.

Could you please describe the meaning of the "Services representing the domain" phrase? I understand an example but to keep a consistency I need to understand this in details.

Thanks a lot!

Thanks for the issue, this practice really sounds a little weird! I think this is out of date. Usually when I build my domain "classes" in active record like way I use factory, like:

module.factory('Developer', function ($http) {
  function Developer(id, langs) {
    this.id = id;
    this.langs = langs;
  }

  Developer.get = function (id) {
    $http.get('/developers/' + id)
     .then(function () {
       // whatever
     });
  };

  Developer.prototype.save = function () {
    $http.post('/developer')
      .then(function () {
         // whatever
      });
  };

   return Developer;
});

or something similar...

Anyway, lets keep the issue open and not make any changes until we have opinion by third party 😄

Thanks for the prompt response.

Got the answer, will skip it for now.