Thanks for the detailed review ! I can work on the PR to implement your
suggestions and make it more compliant with the rest of the project, but
let me know first if this is not already a WIP on SL side. If so, I suppose
there is no reason to merge. Otherwise I'll get it done. Thanks


2014-03-17 8:51 GMT+01:00 Miroslav Bajtoš <notifications@github.com>:

> In lib/services.template:
>
> > @@ -214,6 +214,11 @@ postData.forEach(function(arg) { -%>
> >  <% } -%>
> >        }
> >      );
> > +<% if (app.models[modelName] && app.models[modelName].prototype.clientMethods) app.models[modelName].prototype.clientMethods.forEach(function(fct) { -%>
> > +    res.prototype['<%- fct %>'] = <%- app.models[modelName].prototype[fct] %>;
> > +<% }); // if meta.clientMethods foreach -%>
>
> You should not access app.models directly, all data needed for the code
> generator must be available via RestClass<https://github.com/strongloop/strong-remoting/blob/87ea65685ab9ff442b7769af5e4f24fdacd1fedb/lib/rest-adapter.js#L366>,
> RestMethod<https://github.com/strongloop/strong-remoting/blob/87ea65685ab9ff442b7769af5e4f24fdacd1fedb/lib/rest-adapter.js#L386>and/or
> SharedClass<https://github.com/strongloop/strong-remoting/blob/87ea65685ab9ff442b7769af5e4f24fdacd1fedb/lib/shared-class.js>and
> SharedMethod<https://github.com/strongloop/strong-remoting/blob/87ea65685ab9ff442b7769af5e4f24fdacd1fedb/lib/shared-method.js>
> .
>
> // not tested, just an ideafunction getAllSharedCodeMethods(meta) {
>   var proto = meta.sharedClass.ctor.prototype;
>   return Object.keys(proto)
>     .map(function(k) { return proto[k]; })
>     .filter(function(m) {
>       return typeof(m) == 'function' && m.sharedCode === true;
>     });}
>
> To make the implementation complete, you should support shared-code
> methods defined on the constructor too (e.g. MyModel.getUrlForId(id) {
> /*...*/})
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/strongloop/loopback-angular/pull/25/files#r10647661>
> .
>