Hi James, thanks for your response.
The exact part that i don't like is to repeat this code twice:
*Company factory:*
findAll: function() {
MyResource.doGET('companies');
}
*User factory: *
findAll: function() {
MyResource.doGET('users');
}
I'm searching for a implementation that is similar to rails active record
implementation, when i only extend ActiveModel and the common methods comes
as bonus.
Thanks :)
2014-09-29 12:17 GMT-03:00 James Cooke <[email protected]>:
> Is it the parts like this that you don't like?
> $scope.findUsers = function() {
> User.findAll();
> }
>
> This can be simplified to:
> $scope.findUsers = User.findAll();
>
> You can do
> $scope.userFactory = User;
>
> This means you only have to assign a few things to the view however your
> view then has access to all of the User factory methods. If you don't like
> that perhaps you can wrap up the find users functionality into a directive?
> You don't have to assign anything to the view that way and the factories
> are singletons so any changes in the User factory will be available in your
> controllers and elsewhere too.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/63eLt6Kt_xE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.