-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Philosophy/architecture of angular-data #9
Comments
What was the design decision around these function signatures? Why for example is there a separate error callback, rather than an error promise? Or why is the error not returned as the first parameter of the then callback? i.e. |
@tanepiper angular-data just uses angular's DS.create('post', { author: 'Sally', title: 'Angular gotchas' })
.then(function (post) {
// called on success
}, function (err) {
// called on error
})
.finally(function () {
// always called
}); and DS.create('post', { author: 'Sally', title: 'Angular gotchas' })
.then(function (post) {
// called on success
})
.catch(function (err) {
// called on error
})
.finally(function () {
// always called
}); The error will never be passed as the first argument to the first callback that was passed to Perhaps my example is a bit confusing because I pass |
@jmdobry Ahh I didn't realise that. I've always used the second way though so never seen the first way used. Makes sense now and I'm glad to see they are just promises so fits with my code structuring. |
See the Design Doc for more reading.
One of the things that developers either love or hate about Angular is its use of POJOs and not decorated objects like Backbone or Ember. I personally like POJOs, and I think angular-data should stick with them.
Angular-data won't decorate your data, but it will maintain meta data about your data for its operation. That means that you can manipulate your data directly
obj.foo = 'bar'
, but any asynchronous operations on your data must be performed through angular-data's APIDS.save('document', 45).then(...)
.Angular-data aims to be very pluggable and adaptable. I don't know how big it will be, but angular-data could be engineered to support swappable plugins that angular-data uses at runtime.
Example:
angular-data.js
angular-data-pouchdb.js
angular-data-indexeddb.js
angular-data-goinstant.js
angular-data-firebase.js
The text was updated successfully, but these errors were encountered: