ember.js - view is ignoring contentBinding -


i'm building playlist. have 2 models describing json response server

app.chartsmodel = em.model.extend({   playlist: em.belongsto('app.playlistmodel', { key: 'playlist', embedded: true }) })  app.playlistmodel = em.model.extend({   description: em.attr()   uc_date: em.attr() }) 

the instances of these models loaded controller in route. have primary template:

#playlists   app.playlistview controllerbinding="controllers.playlist" contentbinding="content.playlist" p {{content.playlist}} 

then app.playlistview template looks like:

#playlist   p {{this}}   p {{model}} 

here renders:

<div id="playlists">   <div id="playlist">     <p>       <app.playlistcontroller:ember456>     </p>   </div>   <p>     <app.playlistmodel:ember454>   </p> </div> 

i expected "#playlist" div have p-tag set instance of app.playlistmodel. not sure why contentbinding isn't taking effect.

any ideas?

  • update * appears setting controllerbinding nullifies contentbinding. there way set controller , content in view?

i think loading models controller right approach. assume it's playlistcontroller, model playlist , have property called 'charts' charts instance.

for view, however, should use controller context (not content) , access models through context. not mess controller or context bindings directly nor think of them different. if need specify things in binding, might try using unique name e.g. chartsbinding="controllers.playlist.charts". contentbinding may working. access in template {{content}}, not {{this}}.

anyway, may want try specifying controller view's context like:

#playlists   app.playlistview contextbinding=controller 

then, in app.playlistview template:

#playlist   p {{this}}   p {{charts}}   p {{model}} 

should give you: playlist controller (the context), charts instance, , playlist instance.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -