Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
163
rated 0 times [  169] [ 6]  / answers: 1 / hits: 43055  / 12 Years ago, tue, july 3, 2012, 12:00:00

I'm trying to show some mark up based on the value of $index, I can display the value but I can't seem to use it with an if binding, what's the best approach here?



<!-- ko if: $index===0 -->
<div>some mark up here</div>
<!-- /ko -->

More From » knockout.js

 Answers
3

$index is an observable, and observables are functions. When you use observables in an expression you must use the () form to access the value.



<!-- ko if: $index() === 0 -->

[#84491] Monday, July 2, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jackie

Total Points: 442
Total Questions: 107
Total Answers: 94

Location: Honduras
Member since Sun, Dec 26, 2021
2 Years ago
jackie questions
Sat, Sep 18, 21, 00:00, 3 Years ago
Wed, Jul 14, 21, 00:00, 3 Years ago
;