I am in the mids of following: Vic Ramon EmberJS tutorial. I reached the point where I am trying to list the leads and have the following setup:
Adapter
App.Store = DS.Store.extend()
App.ApplicationAdapter = DS.ActiveModelAdapter.extend()
DS.RESTAdapter.reopen
namespace: 'api/v1'
Controller
App.LeadsController = Ember.ArrayController.extend
sortProperties: ['firstName', 'lastName']
Model
App.Lead = DS.Model.extend
firstName: DS.attr('string')
lastName: DS.attr('string')
email: DS.attr('string')
phone: DS.attr('string')
status: DS.attr('string', defaultValue: 'new')
notes: DS.attr('string')
fullName: (->
@get('firstName') + ' ' + @get('lastName')
).property('firstName', 'lastName')
Routes
App.LeadsRoute = Ember.Route.extend
model: ->
@store.findAll 'lead'
Router
App.Router.reopen
location: 'auto'
rootURL: '/'
App.Router.map ()->
@resource 'leads', path: '/'
@resource 'lead', path: 'leads/:id'
Template
<article>
<h1>Leads</h1>
<ul>
{{#each lead in controller}}
<li>{{#link-to 'lead' lead}}{{/link-to}}</li>
{{lead.fullName}}
{{/each}}
</ul>
</article>
The issue simply is when I redirect my browser to http://localhost:3000
it shows me the list of fullNames but doesn't show me the anchor links. Also another thing I seem to get in my chrome browser console is:
Error message: Assertion Failed: Cannot find model name
Bonus Question
From reading a few books an tutorials I understand that you can include mixins as a way of injecting additional properties into Controllers or Views. So for example you can do:
Ember.View.extend(App.Editable)
But can you include a mixin into a model? As in can you do:
App.Lead = DS.Model.extend(App.SomeMixin)
Aucun commentaire:
Enregistrer un commentaire