Hi Team
I have this code that creates a switch toggle button on and off, but when i try to create a function to call this property within a class. Its complaining its expecting a constructor or method. How do i fix this error "unexpected token"...?
According from the online IDE i am expected to work only on this page this is no Angular CLI project from local IDE. `// code in Angular js 13 import { Component} from '@angular/core'; @Component({ selector: 'toggle-button', template: ` <div class="toggle-button"> <button (click)="toggleState()">{{ yourVariableName === true ? "ON" : "OFF" }} /> </div> `}) export class ToggleButton { buttonState: boolean = false; function toggleState() { // unexected token has an error this.buttonState != this.buttonState; } }`