feat: camelCase Angular (kebab-case removal)
BREAKING CHANGE:
Angular is now fully camel case.
Before:
<p *ng-if="cond">
<my-cmp [my-prop]="exp">
<my-cmp (my-event)="action()">
<my-cmp [(my-prop)]="prop">
<input #my-input>
<template ng-for #my-item [ng-for-of]=items #my-index="index">
After
<p *ngIf="cond">
<my-cmp [myProp]="exp">
<my-cmp (myEvent)="action()">
<my-cmp [(myProp)]="prop">
<input #myInput>`,
<template ngFor="#my-item" [ngForOf]=items #myIndex="index">
The full details are found in [angular2/docs/migration/kebab-case.md](https://github.com/angular/angular/blob/master/modules/angular2/docs/migration/kebab-case.md)
This commit is contained in:
committed by
Igor Minar
parent
b386d1134a
commit
da9b46a071
@@ -39,7 +39,6 @@ import {
|
||||
DefaultRenderFragmentRef,
|
||||
DefaultProtoViewRef
|
||||
} from 'angular2/src/core/render/view';
|
||||
import {camelCaseToDashCase} from './util';
|
||||
import {ViewEncapsulation} from 'angular2/src/core/metadata';
|
||||
|
||||
// TODO move it once DomAdapter is moved
|
||||
@@ -139,11 +138,10 @@ export abstract class DomRenderer extends Renderer implements NodeFactory<Node>
|
||||
attributeValue: string): void {
|
||||
var view = resolveInternalDomView(location.renderView);
|
||||
var element = view.boundElements[location.boundElementIndex];
|
||||
var dashCasedAttributeName = camelCaseToDashCase(attributeName);
|
||||
if (isPresent(attributeValue)) {
|
||||
DOM.setAttribute(element, dashCasedAttributeName, stringify(attributeValue));
|
||||
DOM.setAttribute(element, attributeName, stringify(attributeValue));
|
||||
} else {
|
||||
DOM.removeAttribute(element, dashCasedAttributeName);
|
||||
DOM.removeAttribute(element, attributeName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,11 +158,10 @@ export abstract class DomRenderer extends Renderer implements NodeFactory<Node>
|
||||
setElementStyle(location: RenderElementRef, styleName: string, styleValue: string): void {
|
||||
var view = resolveInternalDomView(location.renderView);
|
||||
var element = view.boundElements[location.boundElementIndex];
|
||||
var dashCasedStyleName = camelCaseToDashCase(styleName);
|
||||
if (isPresent(styleValue)) {
|
||||
DOM.setStyle(element, dashCasedStyleName, stringify(styleValue));
|
||||
DOM.setStyle(element, styleName, stringify(styleValue));
|
||||
} else {
|
||||
DOM.removeStyle(element, dashCasedStyleName);
|
||||
DOM.removeStyle(element, styleName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user