zazvorniki
zazvorniki

Reputation: 3602

Knockout if statement checking value of function

In my app I have several screens that could appear due to a status, available, closed, ext. To make the different parts of the screens appear I was looking at using knockout if statements since the views and such all share the same values and such and it seems a waste to create that many files.

However in my research I could only find knockout if statement that looks like this

<!-- if: Availabilty() -->
    <p>this appears</p>
<!-- /ko -->

And this will check if there are variables there and appear, but I can't seem to make it so it will check to see just what the variable that comes back is.

I have tried something like this

<!-- if: Availabilty === 'Available' -->

or

<!-- if: Availabilty() === 'Available' -->

Any help would be awesome!

Upvotes: 0

Views: 208

Answers (1)

Daniel
Daniel

Reputation: 1198

You are missing the two letters ko: <!-- ko if: Availabilty() === 'Available' -->. Since I assume that Availabilty is an observable, the brackets are necessary to get its value.

Upvotes: 4

Related Questions