Visibility: Hidden in Angular 2

What is the proposed way to achieve the invisibility of an element in angular 2 ( visibility:hiddennot displaying the element, but keeping it occupied) ?. It has a directive [hide], but it looks like adisplay:none

+4
source share
3 answers

You can set the style attribute visibilityusing style binding :

<div [style.visibility]="'hidden'"></div>
<div [style.visibility]="isDivVisible ? 'visible' : 'hidden'"></div>

An example is shown in this plunker .

+15
source

You can execute ngIf if you do not want your component to appear in the DOM.

, , , none NgClass. , , ngIf

0

Try ngShow .

<div ng-show="myValue"></div>

Hide item from controller:

$scope.myValue = false
-3
source

Source: https://habr.com/ru/post/1682124/


All Articles