Skip to content

Instantly share code, notes, and snippets.

@DavertMik
Last active December 12, 2015 07:58
Show Gist options
  • Save DavertMik/4739990 to your computer and use it in GitHub Desktop.
Save DavertMik/4739990 to your computer and use it in GitHub Desktop.
BatmanJS dynamic counters
class YourApp.User extends Batman.Model
@resourceName: 'user'
@storageKey: 'users'
@classAccessor 'invitesAvailable', ->
# for simplicity we use jQuery to grab a limit from a page
$('#invite_limit').val() - @get('loaded').toArray().length
Invites left: <span data-bind="User.invitesAvailable"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment