I have a toggle button , which when clicked should add text 'Dark' to the
tag. When clicked again should replace with 'Light'. Initially there shouldn't be anything.Suppose to use `
@Component({
selector: 'darkmode-toggler',
template: `
<div>
<button>Toggle dark mode</button>
<p></p>
</div>
`,
styles: []
})
export class DarkModeToggler {}
@Component({
selector: 'app-root',
template: `
<div>
<darkmode-toggler (stateChanged)="handleStateChange($event)">
</darkmode-toggler>
</div>
`,
styles: []
})
export class Resource {
handleStateChange(event) {
console.log(event);
}
}