emblem.js icon indicating copy to clipboard operation
emblem.js copied to clipboard

One-way default bindings

Open theazureshadow opened this issue 10 years ago • 4 comments

Ember is moving to one-way bindings by default, if you use the new component syntax (which I don't think has landed yet). How can Emblem handle this transition, since its syntax doesn't need to change substantially?

theazureshadow avatar Mar 26 '15 18:03 theazureshadow

@theazureshadow Emblem will need to print out the mut keyword when it is requested. This is something that we need to figure out still, but I expect something like the following would be the syntax Emblem would adopt:

%my-video src={mut movie.url} paused=controller.isPaused

would be printed like this:

<my-video src={{mut movie.url}} paused={{controller.isPaused}}></my-video>

Emblem 0.5.0+ doesn't yet target HTMLBars syntax (it still uses bind-attr, for instance) yet, so that would be another change. There will eventually be an Emblem release that prints out without using the bind-attr for those on HTMLBars.

bantic avatar Mar 26 '15 18:03 bantic

That's a nice approach. So like HTMLBars, Emblem would use a slightly different syntax (possibly a % prefix) to invoke the new defaults. That would make sense, and provide those of us with a large set of templates a way to migrate them gradually.

theazureshadow avatar Mar 27 '15 03:03 theazureshadow

Hey guys, is this working somehow with Emblem? Thanks.

bnetter avatar Mar 03 '16 15:03 bnetter

@bnetter we're blocked on angle bracket syntax landing in Ember. Til then, emblem bindings will behave as they do in Ember Handlebars/Glimmer when using curly {{x-component foo=bar}} syntax: foo will be two-way bound to bar.

machty avatar Mar 03 '16 15:03 machty