photo_tom
photo_tom

Reputation: 7342

Knockout Native binding, Syntax error with containerless bindings

Working on my first serious native binding template and am making what will be an obvious syntax error. The problem part is below -

<tr class="knockoutGrid-header">
    <!-- ko foreach: columns -->
    <th class="ui-widget-header">
        <!-- ko if:  !$data.NoSort  -->
        <button onclick='viewModel.gridViewModel.SortColumn("$data.rowText", $index)' class='GridSortWrapper'
            title='Click to Sort Column'>
            <div style="display: table">
                <div style="display: table-row">
                    <div class="ClearFix">
                    </div>
                    <div style="display: table-cell; vertical-align: middle; width: 100%;">
                        <label data-bind="text: headerText" />
                    </div>
                    <div style="display: table-cell; vertical-align: middle; width: 18px">
                        <span class='ui-icon $data.iconCss  iconBackground sortIcon'></span>
                    </div>
                    <div class="ClearFix">
                    </div>
                </div>
            </div>
        </button>
        <!-- /ko -->
        <!-- ko if:  $data.NoSort   -->
        <label data-bind="text: headerText" />
        <!-- /ko -->
    </th>
    <!-- /ko -->
</tr>

I'm getting the following error

Uncaught Error: Cannot find closing comment tag to match: ko if: $data.NoSort

I'm using knockout 2.1RC

Upvotes: 2

Views: 1309

Answers (1)

RP Niemeyer
RP Niemeyer

Reputation: 114792

Looks like your problem is here: <label data-bind="text: headerText" />

It should be: <label data-bind="text: headerText"></label>

Upvotes: 5

Related Questions