fix(ngFor): give more instructive error when binding to non-iterable
Before, you'd get an error like: ``` EXCEPTION: Cannot find a differ supporting object ‘[object Object]’ in [users in UsersCmp@2:14] ``` Now, you get: ``` EXCEPTION: Cannot find a differ supporting object ‘[object Object]’ of type 'Object'. Did you mean to bind ngFor to an Array? in [users in UsersCmp@2:14] ```
This commit is contained in:
@ -62,7 +62,10 @@ export interface Type extends Function {}
|
||||
export interface ConcreteType extends Type { new (...args): any; }
|
||||
|
||||
export function getTypeNameForDebugging(type: Type): string {
|
||||
return type['name'];
|
||||
if (type['name']) {
|
||||
return type['name'];
|
||||
}
|
||||
return typeof type;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user