that I just know I’m going to use over and over again in my applicaGon! • Okay, so maybe it’s a li8le different everywhere I need it. But hey, I’m saving myself some typing…
that I just know I’m going to use over and over again in my applicaGon! • Okay, so maybe it’s a li8le different everywhere I need it. But hey, I’m saving myself some typing… • Ugh, I hate maintaining this thing, but at least in 90% of my use cases I can just drop it in place and it will work… I hope.
deals with the inter-‐relaGonships of components. A highly composable system provides recombinant components that can be selected and assembled in various combinaGons to saGsfy specific user requirements.” -‐ Wikipedia (the source of all truth EVER)
{{#my-‐column sortField=“foo”}} {{#my-‐column-‐header}} Foo {{/my-‐column-‐header}} {{#my-‐column-‐cell}} {{row.foo}} {{/my-‐column-‐cell}} {{/my-‐column}} {{#my-‐column sortField=“imageName”}} {{#my-‐column-‐header}} Image {{/my-‐column-‐header}} {{#my-‐column-‐cell}} <a {{bind-‐attr href=row.url}}> <img {{bind-‐attr src=row.imageSrc alt=row.imageName}}/> </a> {{/my-‐column-‐cell}} {{/my-‐column}} {{/my-‐table}} User defined templates • Can be anything the developer needs to be. • Has things like current {{row}} or {{column}} injected into it’s context. • SGll handles outer context and controller acGons!
method to allow children to register themselves. • Add “isSomeComponent” property (can be named anything) to help child components find a reference to the parent. • Add unregister method! • Because we’re pulling templates from child components, we don’t want to render unGl those components have been inserted.
templates, we don’t want them to render, so override renderToBuffer. • We do need to noGfy the parent column that the child exists. • Code for both the header and cell components will be basically the same.
to render the passed templates by sehng the template a8ribute on the view. • You must use {{yield}} to force the child components to be processed at all.
cells and headers can’t see the properGes and acGons on our view controller! {{#my-‐table-‐cell}} <a {{action ‘wee’}}>This doesn’t work</a> <p>WTH? “{{propFromController}}” is blank!</p> {{/my-‐table-‐cell}}
Email: [email protected] Example project: h8p://github.com/blesh/ember-‐composable-‐ components-‐example Neklix data visualizaGon components hopefully part of NeklixOSS soon!