Created
September 4, 2017 15:53
-
-
Save guillaumegarcia13/a00379681d95b0176e10fd3f794bd8bb to your computer and use it in GitHub Desktop.
Angular 4 ng-template & ng-container with parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Thanks 3 years later this is still helping people
Thanks, this is great example
Thanks fot this!
You saved my life! Thanks you so much!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh my God! you saved me! thanks!