Skip to content

Commit b98fac0

Browse files
stefnotchjohnpapa
authored andcommitted
Add more form snippets
1 parent 1627db0 commit b98fac0

File tree

4 files changed

+44
-22
lines changed

4 files changed

+44
-22
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
# 8.3.0 (2019-12-18)
66

7+
- Added `a-form` to create a form tag with ngSubmit and form attributes
8+
- Added `a-form-submit` to create a submit button for a form
79
- Fixed `a-service` to create a service with injectable provided in root
810

911
<a name="8.2.0"></a>

README.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,28 +90,30 @@ Alternatively, press `Ctrl`+`Space` (Windows, Linux) or `Cmd`+`Space` (OSX) to a
9090

9191
### HTML Snippets
9292

93-
| Snippet | Purpose |
94-
| -------------------- | ------------------------------------------ |
95-
| `a-class` | `[class]` binding |
96-
| `a-select` | `<select>` control |
97-
| `a-style` | `[style]` binding |
98-
| `a-ngClass` | `ngClass` |
99-
| `a-ngFor` | `*ngFor` |
100-
| `a-ngForAsync` | `*ngFor` with async |
101-
| `a-ngFor-trackBy` | `*ngFor` with trackBy |
102-
| `a-formArrayName` | `formArrayName` |
103-
| `a-formControlName` | `formControlName` |
104-
| `a-formGroup` | `formGroup` |
105-
| `a-formGroupName` | `formGroupName` |
106-
| `a-ngIf` | `*ngIf` |
107-
| `a-ngIfElse` | `*ngIf` with `else` |
108-
| `a-ngModel` | `ngModel` |
109-
| `a-routerLink` | `routerLink` |
110-
| `a-routerLink-param` | `routerLink` with a route parameter |
111-
| `a-ngStyle` | `ngStyle` |
112-
| `a-ngSwitch` | `ngSwitch` |
113-
| `a-prej` | show the JSON form of a model |
114-
| `a-preja` | show the JSON form of a model, using async |
93+
| Snippet | Purpose |
94+
| -------------------- | --------------------------------------------------- |
95+
| `a-class` | `[class]` binding |
96+
| `a-select` | `<select>` control |
97+
| `a-style` | `[style]` binding |
98+
| `a-ngClass` | `ngClass` |
99+
| `a-ngFor` | `*ngFor` |
100+
| `a-ngForAsync` | `*ngFor` with async |
101+
| `a-ngFor-trackBy` | `*ngFor` with trackBy |
102+
| `a-form` | create a form tag with ngSubmit and form attributes |
103+
| `a-formArrayName` | `formArrayName` |
104+
| `a-formControlName` | `formControlName` |
105+
| `a-formGroup` | `formGroup` |
106+
| `a-formGroupName` | `formGroupName` |
107+
| `a-form-submit` | create a submit button for a form |
108+
| `a-ngIf` | `*ngIf` |
109+
| `a-ngIfElse` | `*ngIf` with `else` |
110+
| `a-ngModel` | `ngModel` |
111+
| `a-routerLink` | `routerLink` |
112+
| `a-routerLink-param` | `routerLink` with a route parameter |
113+
| `a-ngStyle` | `ngStyle` |
114+
| `a-ngSwitch` | `ngSwitch` |
115+
| `a-prej` | show the JSON form of a model |
116+
| `a-preja` | show the JSON form of a model, using async |
115117

116118
### VS Code Snippets
117119

snippets/html.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
"body": ["*ngFor=\"let ${1:item} of ${2:stream} | async as ${3:list}\"${0}"],
3030
"description": "Angular *ngForAsync"
3131
},
32+
"ngForm": {
33+
"prefix": "a-form",
34+
"body": [
35+
"<form (ngSubmit)=\"onSubmit()\" #${1:form}=\"ngForm\">",
36+
"</form>"
37+
],
38+
"description": "Form with ngSubmit and form attributes"
39+
},
3240
"ngFormArrayName": {
3341
"prefix": "a-formArrayName",
3442
"body": [
@@ -57,6 +65,15 @@
5765
],
5866
"description": "Angular formGroupName"
5967
},
68+
"ngFormSubmit": {
69+
"prefix": "a-form-submit",
70+
"body": [
71+
"<button type=\"submit\" [disabled]=\"!${1:form}.form.valid\">",
72+
"\tSave",
73+
"</button>"
74+
],
75+
"description": "Angular form submit"
76+
},
6077
"ngIf": {
6178
"prefix": "a-ngIf",
6279
"body": ["*ngIf=\"${1:expression}\""],

test/test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<html>
22
<body>
33
<div></div>
4+
45
</body>
56
</html>

0 commit comments

Comments
 (0)