Click here to Skip to main content
15,905,875 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi Team

I need some help i have created a template to toggle between on and off but now must find a way to create a component ts so when switch toggle button is on it should and vice versa in Angular

What I have tried:

// @ts-ignore
import { Component } from '@angular/core';

  selector: 'app-toggle-button',
  template: `<ng-container *ngIf="show; then showTpl; else hideTpl">
  <button (click) = "show = !=show">Toggle View</button>
  <ng-tample #showTpl>

  <ng-template #hideTpl>
  styles: [``]

export class MainAppComponent {
  // code goes here

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900