fix(core): Remove ChangeDetectorRef Paramter from KeyValueDifferFactory and IterableDifferFactory (#14311)

BREAKING CHANGE:

- `KeyValueDifferFactory` and `IterableDifferFactory` no longer have `ChangeDetectorRef` as 
  a parameter. It was not used and has been there for historical reasons. If you call 
  `DifferFactory.create(...)` remove the `ChangeDetectorRef` argument.
This commit is contained in:
FrozenPandaz
2017-02-09 16:33:44 -05:00
committed by Miško Hevery
parent 56e2f84fe8
commit 45cc444154
9 changed files with 41 additions and 14 deletions

View File

@ -69,9 +69,9 @@ export class NgClass implements DoCheck {
if (this._rawClass) {
if (isListLikeIterable(this._rawClass)) {
this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create(null);
this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
} else {
this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create(null);
this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
}
}
}

View File

@ -112,7 +112,7 @@ export class NgForOf<T> implements DoCheck,
constructor(
private _viewContainer: ViewContainerRef, private _template: TemplateRef<NgForOfRow<T>>,
private _differs: IterableDiffers, private _cdr: ChangeDetectorRef) {}
private _differs: IterableDiffers) {}
@Input()
set ngForTemplate(value: TemplateRef<NgForOfRow<T>>) {
@ -130,7 +130,7 @@ export class NgForOf<T> implements DoCheck,
const value = changes['ngForOf'].currentValue;
if (!this._differ && value) {
try {
this._differ = this._differs.find(value).create(this._cdr, this.ngForTrackBy);
this._differ = this._differs.find(value).create(this.ngForTrackBy);
} catch (e) {
throw new Error(
`Cannot find a differ supporting object '${value}' of type '${getTypeNameForDebugging(value)}'. NgFor only supports binding to Iterables such as Arrays.`);
@ -253,4 +253,4 @@ class RecordViewTuple<T> {
*
* @deprecated v4.0.0 - Use `NgForOf<T>` instead.
*/
export class NgFor extends NgForOf<any> {}
export class NgFor extends NgForOf<any> {}

View File

@ -42,7 +42,7 @@ export class NgStyle implements DoCheck {
set ngStyle(v: {[key: string]: string}) {
this._ngStyle = v;
if (!this._differ && v) {
this._differ = this._differs.find(v).create(null);
this._differ = this._differs.find(v).create();
}
}