Last active
August 29, 2015 14:16
-
-
Save zampino/373a8d258362117af3ee to your computer and use it in GitHub Desktop.
dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Manager | |
@injects 'Task', 'Store', '...' | |
constructor: -> | |
$http.get('/tasks').success (data)-> | |
# works for nested resources too | |
Store.tasks.push new Task(item) for item in data | |
class Store | |
constructor: -> | |
@tasks, @themes, @chapters | |
class Theme | |
@inject 'Store' | |
constructor: (raw_data)-> | |
@id = raw_data.id | |
tasks: -> | |
@_tasks ||= Store.tasks.findWhere(theme_id: @id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment