Skip to content

Instantly share code, notes, and snippets.

@karthikchintala1
Created August 26, 2017 13:07
Show Gist options
  • Save karthikchintala1/732ff984495ad3f6625776546971c979 to your computer and use it in GitHub Desktop.
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
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