ember.js - Use "subcontrollers" in EmberJS -


i'm having trouble designing emberjs layout. have view divided in 2 parts :

  • a content library on left
  • a playlist editor on right

currently, 2 elements share same controller.

i can't figure how use 2 different controllers 2 sides able re-use content library in other views or having view 2 playlist editors.

my root view looks far :

<script type="text/x-handlebars" data-template-name="playlists">     <div id="library">{{template library}}</div>     <div id="playlisteditor">{{template playlisteditor}}</div> </script> 

i saw docs {{control}} helper, unstable , i'm not sure i'm looking for.

thanks !

okay, found answer, had use {{render}} helper, :

<script type="text/x-handlebars" data-template-name="playlists">     <div id="library">{{render "library" library}}</div>     <div id="playlisteditor">{{render "playlisteditor" playlist}}</div> </script> 

then, in route :

app.playlistsroute = ember.route.extend({   setupcontroller: function(controller) {      controller.set('playlist', playlist);      controller.set('library', library);   } }); 

then, emberjs automatically wire app.playlisteditorcontroller, app.librarycontroller , views playlisteditor , library. awesome.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -