Ihor Khomiak
Ihor Khomiak

Reputation: 1189

Is there an analogue of "ngIf" directive in NativeScript without Angular?

In Angular, we can use *ngIf directive in the template in case if we want to create/remove (also show/hide) dom element.

Is there an analog of "ngIf" directive in NativeScript without Angular?

Upvotes: 2

Views: 547

Answers (1)

Dhananjay C
Dhananjay C

Reputation: 597

NativeScript supports the "collapsed" and "visible" states of the CSS visibility property. This means you can hide an element by setting its "visibility" property to "collapsed" in CSS.

And you can conditionally change its property which will be (near about) same as angular's ngIf condition.

   visibility="{{ showTextDetails ? 'visible' : 'collapsed' }}"

Hope this help!

Upvotes: 3

Related Questions