bfanger / angular-activerecord

A model layer for AngularJS inspired by Backbone.Model
MIT License
137 stars 28 forks source link

Make it as provider #6

Closed smacker closed 10 years ago

smacker commented 11 years ago

Right now your module is a factory. What do you think about converting it to provider?

I've I issue to convert all responses (return data.items) and requests (add token) in my app, also all my urls have a prefix. It's possible to override $parse, $sync, url method in my class, then extend this class, but it looks not like angular's way.

Provider lets override those functions in config of application. That looks much cleaner.

smacker commented 11 years ago

I do have a example. You can see it here: https://github.com/smacker/angular-activerecord/commit/7f9c697aa7f8eb0b3eac6ca095aa3dfb3413b8a9

bfanger commented 10 years ago

I believe a Factory is the correct type, i want the ActiveRecord class to behave as predictable as possible. Making it a Provider would promote the behavioral differences per project.

You can still override functions using the $provide.decorator if you wanted to.