Hi team
I need some help with my logic below, basically i am answering this instruction below using angular js to create switch toggle button in Angular.
//instructions for the task.
We provided some simple Angular template code. Your goal is to modify the component so that you can properly toggle the button to switch between an ON state and an OFF state. When the button is on and it is clicked, it turns off and the text within it changes from ON to OFF and vice versa.
// code solution but its not showing any UI to switch on and off.
// @ts-ignore
`import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-area',
template: `
ON
`,
styles: []
})
export class MainAppComponent implements OnInit {
// code goes here
ngOnInit() {
}
}`
Top comments (6)
@nlxdodge dont worry man got it figured it out, its working that was then while busy researching and been stuck then
@nlxdodge when im using a function complaining that it expects a constructor, how do i get rid of this error..?
I believe my variablename will be toggle-button i guess, so the function must use it below the class and remove onInit method?. Please share full logic i dont want to miss steps