Guest User

Untitled

a guest
Dec 6th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.App = {}
  2.  
  3. # models
  4. App.Employee = Backbone.Model.extend()
  5. App.Employees = Backbone.Collection.extend
  6.   model: App.Employee
  7.  
  8. # views
  9. App.EmployeeView = Backbone.View.extend
  10.   initialize: ->
  11.     @model.on('change', @render, this)
  12.     @model.on('destroy', @remove, this)
  13.  
  14.   render: ->
  15.     fullName = "#{@model.get('firstName')} #{@model.get('lastName')} "
  16.    
  17.     this.$el.text(fullName)
  18.     this
  19.  
  20. App.EmployeesView = Backbone.View.extend
  21.   collection: new App.Employees()
  22.  
  23.   initialize: ->
  24.     @collection.on('add', ...)
  25.     @collection.on('reset', ...)
Add Comment
Please, Sign In to add comment