How to display different content in template with different conditions?


#1

Hi, I’m new to EmberJS. I want to display a button of 4 different states which are based on the conditions of some variables’ values.

Let’s say Person Another is a contact in my phone book, I imported him into my app.

Condition A

Person Another is not a member of the app so I need to invite him. The button would be Invite.

Condition B

Person Another is a member but not my contact in the app, and I could add him directly. The button would be Add.

Condition C

After I send request of Condition A or Condition B, there would be a message like Waiting for response.

Condition D

After we’ve been contacts, there would be a message like Contact.

I need to check Person Another if he is a member of the app and if I’ve sent out a request before.

Should I define a view or component? Or is there a better way?

ref: https://stackoverflow.com/questions/17035546/handlebars-template-with-multiple-states


#2

use view and you can do it