ember.js - Emberjs controller needs with Binding -


i have nested resources:

    this.resource('foo', {path: '/foo/:foo_id'}, function() {         this.route('makesomethingwithfoo');          this.resource('bar', {path: 'bar/:bar_id'}, function() {             this.route('makesomethingwithbar'); 

i want use properties model foo in, while i'm in #/foo/321421/bar/231421. barindexcontroller looks this:

   ... = ember.objectcontroller.extend({     needs:'fooindex',     //mybinding: 'controllers.fooindex',     ....}); 

in template if use controllers.fooindex.desiredproperty can access property of model foo. wanted use mybinding in order spare writing few characters more ( controllers.fooindex). think did right, @ least seems right according documentation. error:

     uncaught error: assertion failed: cannot delegate set('my', <(subclass of       ember.objectcontroller):ember238>) 'content' property of object proxy      <(subclass of ember.objectcontroller):ember249>: 'content' undefined  

the controller has model foo. fooindex route implicit nested route of foo route, , hence has controller of it's own. nested fooindexcontroller needs lookup model on it's parent routes needed.

in case bar route needs use foo instead of fooindex in needs declaration.

needs:'foo', foobinding: 'controllers.foo' 

the foobinding optional. shortens lookup this.get('foo'). might want refer answer clarify nested resources in ember.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -