Created
August 26, 2017 13:07
-
-
Save karthikchintala1/732ff984495ad3f6625776546971c979 to your computer and use it in GitHub Desktop.
A child component which will hide based on the visible variable. For more, visit http://angularman.wordpress.com
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
import { Component } from '@angular/core' | |
@Component({ | |
selector: 'toggle', | |
template: ` | |
<div *ngIf="visible" style="color: green;"> | |
<h3>The content in the child component</h3> | |
</div> | |
` | |
}) | |
export class ToggleComponent { | |
visible: boolean = true; | |
toggle(): void{ | |
this.visible = !this.visible; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment