Skip to content

Instantly share code, notes, and snippets.

@davidstump
Last active August 29, 2015 14:18
Show Gist options
  • Save davidstump/fc8544865837f6aa99af to your computer and use it in GitHub Desktop.
Save davidstump/fc8544865837f6aa99af to your computer and use it in GitHub Desktop.
NGService Example
class Thing extends @NGService
@$inject: []
edit: (id) ->
@notify "thing:edit", id
reload: ->
@notify "thing:reload"
class FirstController extends @NGController
@$inject: ['Thing']
doSomething: ->
@Thing.edit(1)
class SecondController extends @NGController
@$inject: ['Thing']
init: ->
@Thing.on "thing:edit", (data) ->
# stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment