Rate two steering conditions using ember

I was wondering if it is possible to do something like this:

{{#if ClientController.Client.number && PhoneController.hasLinesToInstall}} ... {{/if}}} 

Thanks,

Juanitos

+6
source share
3 answers

I donโ€™t think itโ€™s possible to connect conditions such as steering wheels like this - I canโ€™t find anything about it in the documentation.

You could attach them, for example:

 {{#if ClientController.Client.number}} {{#if PhoneController.hasLinesToInstall}} ... {{/if}} {{/if}} 

This will lead to the same result.

+7
source

It is not supported out of the box, but you can use the addon https://github.com/jmurphyau/ember-truth-helpers :

 ember install ember-truth-helpers 

Then in your template:

 {{#if (and ClientController.Client.number PhoneController.hasLinesToInstall)}} ... {{/if}}} 

Formerly, the understanding of the community was that templates should be largely free of logic. The overtime view has shifted toward more declarative logic in templates - along with ember-truth-helpers , ember-composable-helpers is a great example.

+1
source

For me this worked:

 Ember.computed.and('firstComputedProperty', 'secondComputedProperty') 
+1
source

Source: https://habr.com/ru/post/945172/


All Articles