Skip to content

Instantly share code, notes, and snippets.

@guibot17
Forked from guillaumegarcia13/sample.html
Created December 21, 2017 07:58
Show Gist options
  • Save guibot17/844e36a956c8e93b0fd6f942774c2f47 to your computer and use it in GitHub Desktop.
Save guibot17/844e36a956c8e93b0fd6f942774c2f47 to your computer and use it in GitHub Desktop.
Angular 4 ng-template & ng-container with parameters
<ng-template #followingpost let-author="author" let-age="age" let-text="text" let-badge="badge">
<div class="container-fluid">
<div class="card">
<div class="header">
<h4 class="title">{{ author }}</h4>
<p class="category">il y a {{ age }} jours</p>
</div>
<div class="content" [innerHTML]="text">
</div>
<div class="text-right">
<button class="btn btn-icon btn-simple"><i class="ti-comment"></i></button>
<button class="btn btn-icon btn-simple">
<i class="ti-heart"></i>
<span *ngIf="badge" class="badge">{{ badge }}</span>
</button>
<button class="btn btn-icon btn-simple"><i class="ti-share"></i></button>
</div>
</div>
</div>
</ng-template>
<ng-container *ngTemplateOutlet="followingpost;context:{author: 'Timothy', age: 2, badge: 18, text: 'Les Français qui payent plus de 2500 € d impôt peuvent bénéficier de cette loi : <a href=`http://bit.ly/2xxMicY`>http://bit.ly/2xxMicY</a>'}"></ng-container>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment