Search
 
SCRIPT & CODE EXAMPLE
 

HTML

ngif else

<div *ngIf="isLoggedIn; else loggedOut">
  Welcome back, friend.
</div>

<ng-template #loggedOut>
  Please friend, login.
</ng-template>
Comment

ng if else

<div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
<ng-template #elseBlock>Content to render when condition is false.</ng-template>
Comment

ng else if

    <ng-container *ngIf="isDone; else elseNotDone">
      It's Done!
    </ng-container>

    <ng-template #elseNotDone>
      It's Not Done!
    </ng-template>
Comment

ng if else

<div *ngIf="condition; then thenBlock else elseBlock"></div>
<ng-template #thenBlock>Content to render when condition is true.</ng-template>
<ng-template #elseBlock>Content to render when condition is false.</ng-template>
    
Comment

Angular If else

<div *ngIf="isValid;else other_content">
    content here ...
</div>

<ng-template #other_content>other content here...</ng-template>

<div *ngIf="isValid;then content else other_content">here is ignored</div>
<ng-template #content>content here...</ng-template>
<ng-template #other_content>other content here...</ng-template>

<div *ngIf="isValid;then content"></div>
<ng-template #content>content here...</ng-template>
Comment

ngIf else

      
        content_copy
      
      <div *ngIf="condition; then thenBlock else elseBlock"></div>
<ng-template #thenBlock>Content to render when condition is true.</ng-template>
<ng-template #elseBlock>Content to render when condition is false.</ng-template>
    
Comment

ngif else if

<ng-container *ngIf="foo === 1;else second"></ng-container>
<ng-template #second>
    <ng-container *ngIf="foo === 2;else third"></ng-container>
</ng-template>
<ng-template #third></ng-template>
Comment

ngif else

<div *ngIf="isLoggedIn; else loggedOut">
  Welcome back, friend.
</div>

<ng-template #loggedOut>
  Please friend, login.
</ng-template>
Comment

ng if

<div *ngIf="condition">
Comment

ng if


      
<ng-template [ngIf]="heroes" [ngIfElse]="loading">
 <div class="hero-list">
  ...
 </div>
</ng-template>

<ng-template #loading>
 <div>Loading...</div>
</ng-template>
    
Comment

ngif else angular

<p *ngIf="serverCreated; else noServer">Server was created.</p>
<ng-template #noServer><p>No Server was created</p></ng-template>
Comment

ng elseif

<ng-container *ngIf="tipo_template === 0">
     <!-- Conteúdo 0 aqui -->
</ng-container>

<ng-container *ngIf="tipo_template === 1">
     <!-- Conteúdo 1 aqui -->
</ng-container>

<ng-container *ngIf="tipo_template === 2">
     <!-- Conteúdo 2 aqui -->
</ng-container>
Comment

ngif else

<div *ngIf="isValid;else other_content">
    content here ...
</div>

<ng-template #other_content>other content here...</ng-template>
Comment

ng-if

<label>Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /></label><br/>
Show when checked:
<span ng-if="checked" class="animate-if">
  This is removed when the checkbox is unchecked.
</span>
Comment

ng if else

<div *ngIf="condition; else elseBlock">
	Content to render when condition is true.
</div>
<ng-template #elseBlock>
	Content to render when condition is false.
</ng-template>
Comment

ngif else

<div *ngIf="isValid; else templateName">
    If isValid is true
</div>

<ng-template #templateName>
    If isValid is false
</ng-template>
Comment

ng else

<div *ngIf="isValid;else other_content">
    content here ...
</div>

<ng-template #other_content>other content here...</ng-template>
Comment

PREVIOUS NEXT
Code Example
Html :: how to get text in middle of page html 
Html :: images in html 
Html :: input disable autocomplete 
Html :: CSS apply to selected option in select tag 
Html :: css change color on hover 
Html :: html images with link 
Html :: html make a table with two top headers 
Html :: how to round the edges of an image in HTML 
Html :: how to disable li tag in html 
Html :: path width svg change 
Html :: favicon.ico 404 
Html :: html video disable controls 
Html :: font awesome 6 pro 
Html :: bootstrap 5 tabs 
Html :: checkbox switch bootstrap 
Html :: htlm link 
Html :: html reload button 
Html :: meta tag tester 
Html :: Prettier not formatting HTML files in VS Code 
Html :: html boilerplate code 
Html :: row merge 
Html :: differences between html and xhtml 
Html :: faire un footer avec bootstrap 
Html :: table column width 
Html :: nested select option in html 
Html :: Bootstrap class make your form inputs look nicer 
Html :: when does useeffect return run 
Html :: password input type in html 
Html :: draw vertical line tailwind css 
Html :: table bootstrap with scrool 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =