Skip to content

Instantly share code, notes, and snippets.

@CarlLee
Last active December 16, 2015 19:39
Show Gist options
  • Save CarlLee/5487000 to your computer and use it in GitHub Desktop.
Save CarlLee/5487000 to your computer and use it in GitHub Desktop.
NimbusBase angularjs integration.
Nimbus.angularService = ()->
(name, attrs, sync_callback)->
store = Nimbus.Model.setup(name, attrs)
store.sync_all(sync_callback)
store
myapp.fatory 'nimbusStorage', Nimbus.angularService
myapp.controller 'MyCtrl', ($scope, nimbusStorage)->
store = nimbusStorage('note', ['title', 'date'], ()->
console.log "all notes synced."
)
store.create {
'title': 'hello',
'date': new Date
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment