Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using expressions, converters ... #4

Open
doktordirk opened this issue Jun 15, 2018 · 1 comment
Open

Using expressions, converters ... #4

doktordirk opened this issue Jun 15, 2018 · 1 comment

Comments

@doktordirk
Copy link

doktordirk commented Jun 15, 2018

Seems that personsStats != 0 & async: { property: value} or personsStats & async: { property: value} != 0 or personsStats | isNotZero & async: { property: value} or personsStats & async: { property: value} | isNotZero aren't possible.

one way to allow evaluation of the async bound value would be:

personsStats & async: { property: value, converter: isNotZero}

thoughts? other options (well, i could filter the stream, but i need that for several values separately. hence too much code repetition to be a good idea)?

edit: ah, asyncIsNotZero works: eg

import { filter} from 'rxjs/operators';

export class asyncIsNotZeroValueConverter {
  toView(stream, option) {
    return stream.pipe(
      filter(data=> data[option] !== 0)
    );
  }
}
<div repeat.for="attribute of attributes" if.bind="stats | asyncIsNotZero:attribute.name & async: { property: attribute.name}">

something more generic would be nice still

@zewa666
Copy link
Owner

zewa666 commented Jun 16, 2018

Yeah like an async adapter for valueconverters. Essentially it could be as proposed with converter, but this breaks chaining and looks rather clunky right? Ideally we could use personStats | toAsync: isNotZero : otheropts & async: { ... }. In worst case the VC would have to be passed in as a string.

Another alternative would be to register async variants of VCs globally via code with ab alias, like in your sample asyncIsNotZero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants