mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-11 13:23:02 -05:00
30 lines
562 B
TypeScript
30 lines
562 B
TypeScript
import { Component } from '@angular/core';
|
|
|
|
@Component({
|
|
standalone: true,
|
|
selector: 'app-root',
|
|
template: `
|
|
<label for="agree">Agreed</label>
|
|
<input
|
|
class="ml-2"
|
|
id="agree"
|
|
type="checkbox"
|
|
[value]="check"
|
|
(input)="toggleCheck()" />
|
|
<button
|
|
class="ml-10 rounded-lg border p-2"
|
|
[class.bg-gray-500]="!check"
|
|
[class.text-white]="!check"
|
|
[disabled]="!check">
|
|
Submit
|
|
</button>
|
|
`,
|
|
})
|
|
export class AppComponent {
|
|
check = false;
|
|
|
|
toggleCheck() {
|
|
this.check = !this.check;
|
|
}
|
|
}
|