From b0c735f72c72168e253dd2ada963b1fc417ba15b Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 7 May 2015 12:30:18 -0700 Subject: [PATCH] fix(decorators): incorrect annotation to decorator adapter --- modules/angular2/src/util/decorators.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/angular2/src/util/decorators.ts b/modules/angular2/src/util/decorators.ts index 38a333f5de..0874b3c402 100644 --- a/modules/angular2/src/util/decorators.ts +++ b/modules/angular2/src/util/decorators.ts @@ -9,8 +9,8 @@ export function makeDecorator(annotationCls) { if (!(Reflect && Reflect.getMetadata)) { throw 'reflect-metadata shim is required when using class decorators'; } - var annotationInstance = Object.create(annotationCls); - annotationCls.call(annotationInstance, args); + var annotationInstance = Object.create(annotationCls.prototype); + annotationCls.apply(annotationInstance, args); return function(cls) { var annotations = Reflect.getMetadata('annotations', cls); annotations = annotations || []; @@ -28,8 +28,8 @@ export function makeParamDecorator(annotationCls) { if (!(Reflect && Reflect.getMetadata)) { throw 'reflect-metadata shim is required when using parameter decorators'; } - var annotationInstance = Object.create(annotationCls); - annotationCls.call(annotationInstance, args); + var annotationInstance = Object.create(annotationCls.prototype); + annotationCls.apply(annotationInstance, args); return function(cls, unusedKey, index) { var parameters = Reflect.getMetadata('parameters', cls); parameters = parameters || [];