knockout.js Equivalents of AngularJS bindings ngHide


Example

There is no direct equivalent binding in KnockoutJS. However, since hiding is just the opposite of showing, we can just invert the example for Knockout's ngShow equivalent.

<p ng-hide="SomeScopeProperty">This is conditionally shown.</p>

KnockoutJS equivalent:

<p data-bind="visible: !SomeScopeObservable()">This is conditionally hidden.</p>

The above KnockoutJS example assumes SomeScopeObservable is an observable, and because we use it in an expression (because of the ! operator in front of it) we cannot omit the () at the end.