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

Comparation(#compare var1 "==" var2) with two variables doesn't work #387

Open
noroxi7 opened this issue Aug 9, 2021 · 1 comment
Open

Comments

@noroxi7
Copy link

noroxi7 commented Aug 9, 2021

Hi I can't fix this, i search every where but nothing, here is my .hbs view:

{{#each owners}}
  {{#each ../users}}
    {{#compare _id "==" ../_id}}
      <li>{{this.firstName}} {{this.lastName}}</li>
    {{/compare}}
  {{/each}}
{{/each}}

But #compare doesn't work, when i use an _id as string and compare with any two variables it works, but when i use two variables it doesn't:

versions:

"handlebars": "^4.7.7",
"handlebars-helpers": "^0.10.0",
"handlebars-intl": "^1.1.2",

I'm using it with nodejs and express, please any help
I'd try with #eqand #is but even it doesn't work !!

@noroxi7 noroxi7 changed the title Comparation(#compare var1 "==" var2) width two variables doesn't work Comparation(#compare var1 "==" var2) with two variables doesn't work Aug 9, 2021
@Devilthehell
Copy link

Hey @Noroxi,

I am fairly new to GitHub, please forgive me for any mistakes.
I ran a test in my system from inside of a withsort loop, and it worked just fine.
ItemPrice and ItemsPrice are variables. They equal, and the "Equals" was produced.

{{#compare ItemPrice "==" ../ItemsPrice}} Equals {{/compare}}Outside: {{../ItemsPrice}} Inside: {{ItemPrice}}

The only thing that strikes me about the script you have, is that you are using:

{{#each ../users}}

Wouldn't this mean that you are going back out a level?
Would this mean instead of using "../_id" you should use... "../owners._id"?
I am just not sure how you are going outside to get into users, and then going outside for an "_id"?
Let me know what you think.

Thank You.

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