aurelia / templating-binding

An implementation of the templating engine's Binding Language abstraction which uses a pluggable command syntax.
MIT License
32 stars 26 forks source link

translate [class|style|css].bind="someObject" to an interpolation binding #23

Closed jdanyow closed 5 years ago

jdanyow commented 9 years ago

discussion

Example:

view

<div css.bind="styles" class.bind="classes"></div>

view-model

export class Foo {
  constructor() {
    this.styles = {
      color: green;
    };
    this.classes = {
      danger: false;
    }; 

    setTimeout(() => {
      // expected behavior- element's style and class list should react to these changes.
      this.styles.color = 'red';
      this.classes.danger = true;
    }, 5000);
  }
}

Notes:

Alxandr commented 9 years ago

Discussion

TLDR:

I think not supporting new properties will be a major pitfall Likely, it'll end up with users spamming issues about it

EisenbergEffect commented 9 years ago

Understood. I think we can do it eventually, but should probably not for this first pass. We can add some documentation on that and then try to address it after we do further core work on the binding system.

Alexander-Taran commented 6 years ago

still not working. but maybe nobody cares

EisenbergEffect commented 6 years ago

We can keep this open, though it's love priority since this doesn't block people from achieving the same end result through other means today.

Esger commented 6 years ago

I do care and I write getters like get fontStyle(){ return this._fontStyle; } and use that like <div css="font:${fontStyle}"></div> i.s.o. css.bind="..." The getter will act like a property that gets re-evaluated automatically through the string interpolation ${}. See https://ilikekillnerds.com/2016/02/binding-with-style-in-aurelia/

Alexander-Taran commented 5 years ago

@EisenbergEffect added to vNext candidates list. Can be closed