You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- while tag name are case sensitive, the best practice is to use dash case for component elements so that the browser
@@ -28,135 +32,158 @@ Notes:
28
32
29
33
1. Directives selectors, property bindings, event bindings, template variables and template element attributes should be changed to camel case:
30
34
31
-
Examples:
32
-
-`<p *ng-if="cond">` should be changed to `<p *ngIf="cond">`,
33
-
-`<my-cmp [my-prop]="exp">` should be changed to `<my-cmp [myProp]="exp">`,
34
-
-`<my-cmp (my-event)="action()">` should be changed to `<my-cmp (myEvent)="action()">`,
35
-
-`<my-cmp [(my-prop)]="prop">` should be changed to `<my-cmp [(myProp)]="prop">`,
36
-
-`<input #my-input>` should be changed to `<input #myInput>`,
37
-
-`<template ng-for #my-item [ng-for-of]=items #my-index="index">` should be changed to `<template ngFor="#my-item" [ngForOf]=items #myIndex="index">`,
35
+
Examples:
36
+
-`<p *ng-if="cond">` should be changed to `<p *ngIf="cond">`,
37
+
-`<my-cmp [my-prop]="exp">` should be changed to `<my-cmp [myProp]="exp">`,
38
+
-`<my-cmp (my-event)="action()">` should be changed to `<my-cmp (myEvent)="action()">`,
39
+
-`<my-cmp [(my-prop)]="prop">` should be changed to `<my-cmp [(myProp)]="prop">`,
40
+
-`<input #my-input>` should be changed to `<input #myInput>`,
41
+
-`<template ng-for #my-item [ng-for-of]=items #my-index="index">` should be changed to `<template ngFor="#my-item" [ngForOf]=items #myIndex="index">`,
38
42
39
-
Note: while the tag names are now case sensitive the best practice is to keep them lower dash cased so that the browser
40
-
treat them as custom elements. This explains why the `<router-outlet>` component is left unchanged.
43
+
Note: while the tag names are now case-sensitive the best practice is to keep them lower-dash-cased so that the browser
44
+
treat them as custom elements. Using dashes in custom element names is required by the [Custom Element HTML Spec](http://www.w3.org/TR/custom-elements/#concepts).
45
+
This explains why the `<router-outlet>` component is left unchanged.
41
46
42
-
`on-`, `bindon-`, `bind-` and `var-` prefixes are still part of the canonical syntax and should remain unchanged (lower cased):
43
-
-`on-some-event` should be changed to `on-someEvent`,
44
-
-`bind-my-prop` should be changed to `bind-myProp`,
45
-
-`bindon-my-prop` should be changed to `bindon-myProp`,
46
-
-`var-my-var` should be changed to `var-myVar`.
47
+
`on-`, `bindon-`, `bind-` and `var-` prefixes are still part of the canonical syntax and should remain unchanged (lower cased):
48
+
-`on-some-event` should be changed to `on-someEvent`,
49
+
-`bind-my-prop` should be changed to `bind-myProp`,
50
+
-`bindon-my-prop` should be changed to `bindon-myProp`,
51
+
-`var-my-var` should be changed to `var-myVar`.
47
52
48
53
2. Update variable binding
49
54
50
-
-`<p #var1="a-b" var-var2="c-d">` should be changed to `<p #var1="aB" var-var2="cD">`
55
+
-`<p #var1="a-b" var-var2="c-d">` should be changed to `<p #var1="aB" var-var2="cD">`
51
56
52
57
3. The `template` attribute values should also be updated in the same way
53
58
54
-
`<p template="ng-for #my-item of items #my-index = index">` should be changed to `<p template="ngFor #myItem of items #myIndex = index">`.
59
+
`<p template="ng-for #my-item of items #my-index = index">` should be changed to `<p template="ngFor #myItem of items #myIndex = index">`.
55
60
56
-
Note that both angular directives and your own directives must be updated in the same way.
61
+
Note that both angular directives and your own directives must be updated in the same way.
57
62
58
63
#### Directives and Components
59
64
60
65
Take the following steps to upgrade your directives and components:
61
66
62
67
1. Update the selector:
68
+
```
69
+
@Directive({selector: 'tag[attr][name=value]'})
70
+
@Component({selector: 'tag[attr][name=value]'})
71
+
```
63
72
64
-
@Directive({selector: 'tag[attr][name=value]'})
65
-
@Component({selector: 'tag[attr][name=value]'})
73
+
Tag and attributes names are case sensitive:
74
+
- For tag names, the best practice is to keep them lower dash cased, do not update them,
75
+
- For attribute names, the best practice is to convert them from lower dash case to camel case.
66
76
67
-
Tag and attributes names are case sensitive:
68
-
- For tag names, the best practice is to keep them lower dash cased, do not update them,
69
-
- For attribute names, the best practice is to convert them from lower dash case to camel case.
77
+
Examples:
78
+
-`custom-tag` should stay `custom-tag` (do not update tag names),
79
+
-`[attr-name]` should be updated to `[attrName]`,
80
+
-`[attr-name=someValue]` should be updated to `[attrName=someValue]`,
81
+
-`custom-tag[attr-name=someValue]` should be updated to `custom-tag[attrName=someValue]`
70
82
71
-
Examples:
72
-
-`custom-tag` should stay `custom-tag` (do not update tag names),
73
-
-`[attr-name]` should be updated to `[attrName]`,
74
-
-`[attr-name=someValue]` should be updated to `[attrName=someValue]`,
75
-
-`custom-tag[attr-name=someValue]` should be updated to `custom-tag[attrName=someValue]`
76
-
77
-
Note: attribute values and classes are still matched case insensitive.
83
+
Note: attribute values and classes are still matched case insensitive.
0 commit comments