-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathinputs.component.ts
More file actions
65 lines (57 loc) · 1.36 KB
/
inputs.component.ts
File metadata and controls
65 lines (57 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Component } from '@angular/core';
@Component({
selector: 'app-inputs',
templateUrl: './inputs.component.html',
standalone: false
})
export class InputsComponent {
datetime? = '1994-03-15';
input? = 'some text';
inputOtp? = '1234';
checkbox = true;
radio? = 'nes';
toggle = true;
select? = 'nes';
changes = 0;
range? = 50;
textarea? = 'some text';
// States
isDisabled = false;
isReadonly = false;
setValues() {
console.log('set values');
this.datetime = '1994-03-15';
this.input = 'some text';
this.inputOtp = '1234';
this.checkbox = true;
this.radio = 'nes';
this.toggle = true;
this.select = 'nes';
this.range = 50;
this.textarea = 'some text';
}
resetValues() {
console.log('reset values');
this.datetime = undefined;
this.input = undefined;
this.inputOtp = undefined;
this.checkbox = false;
this.radio = undefined;
this.toggle = false;
this.select = undefined;
this.range = undefined;
this.textarea = undefined;
}
toggleDisable() {
console.log(`toggle disable to ${!this.isDisabled}`);
this.isDisabled = !this.isDisabled;
}
toggleReadonly() {
console.log(`toggle readonly to ${!this.isReadonly}`);
this.isReadonly = !this.isReadonly;
}
counter() {
this.changes++;
return Math.floor(this.changes / 2);
}
}