0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Angular ng-templateでngIf を使う方法

Posted at

普通のタグでngIfを使う場合

<div *ngIf="ishide">
 </div>

こんな感じで*ngIfをclassとかと同じようにタグの中に書く。

ただし、ng-templateで使う場合は少し書き方が異なるみたいだ。。。

ng-templateでngIf を使う

 <ng-template [ngIf]="!isLocked" [ngIfElse]="notLocked">
    <h2>
      現在ロック機能は無効です
    </h2>
 </ng-template>

 <ng-template #notLocked>
    <h2>
      現在ロック機能は有効です
    </h2>
 </ng-template>

こんな感じに[ngIf]="!isLocked"のように書くようだ。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?