Skip to content

Commit e090fde

Browse files
committed
Use ReflectorReader to get inputs (fixes #3007)
1 parent 60ebd44 commit e090fde

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

package.json

+5-6
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@
5656
},
5757
"license": "MIT",
5858
"devDependencies": {
59-
"@angular/common": "^2.0.0-rc.7",
60-
"@angular/compiler": "^2.0.0-rc.7",
61-
"@angular/core": "^2.0.0-rc.7",
62-
"@angular/platform-browser": "^2.0.0-rc.7",
63-
"@angular/platform-browser-dynamic": "^2.0.0-rc.7",
59+
"@angular/common": "^2.0.0",
60+
"@angular/compiler": "^2.0.0",
61+
"@angular/core": "^2.0.0",
62+
"@angular/platform-browser": "^2.0.0",
63+
"@angular/platform-browser-dynamic": "^2.0.0",
6464
"babel-core": "^5.8.14",
6565
"clone": "^1.0.2",
6666
"conventional-changelog": "^1.1.0",
@@ -80,7 +80,6 @@
8080
"lodash": "^4.5.1",
8181
"parallelshell": "^2.0.0",
8282
"phantomjs-polyfill": "0.0.1",
83-
"reflect-metadata": "=0.1.2",
8483
"remap-istanbul": "^0.6.3",
8584
"rxjs": "5.0.0-beta.12",
8685
"shelljs": "^0.7.0",

src/ng2/directives/uiView.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Component, ComponentFactoryResolver, ViewContainerRef, Input, ComponentRef, Type,
44
ReflectiveInjector, ViewChild, Injector, Inject
55
} from '@angular/core';
6+
import {ReflectorReader, reflector} from '../private_import_core';
67

78
import {UIRouter} from "../../router";
89
import {trace} from "../../common/trace";
@@ -27,12 +28,10 @@ interface InputMapping {
2728
prop: string;
2829
}
2930

30-
declare var Reflect: any;
31-
3231
/** @hidden */
3332
const ng2ComponentInputs = (ng2CompClass: Type<any>) => {
3433
/** Get "@Input('foo') _foo" inputs */
35-
let props = Reflect['getMetadata']('propMetadata', ng2CompClass);
34+
let props = reflector.propMetadata(ng2CompClass);
3635
let _props = Object.keys(props || {})
3736
// -> [ { key: string, anno: annotations[] } ] tuples
3837
.map(key => ({ key, annoArr: props[key] }))
@@ -44,7 +43,7 @@ const ng2ComponentInputs = (ng2CompClass: Type<any>) => {
4443
.map(tuple => ({ token: tuple.anno.bindingPropertyName || tuple.key, prop: tuple.key }));
4544

4645
/** Get "inputs: ['foo']" inputs */
47-
let inputs = Reflect['getMetadata']('annotations', ng2CompClass)
46+
let inputs = reflector.annotations(ng2CompClass)
4847
// Find the ComponentMetadata class annotation
4948
.filter(x => x instanceof Component && !!x.inputs)
5049
// Get the .inputs string array

src/ng2/private_import_core.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { __core_private__ as r} from '@angular/core';
2+
export type ReflectorReader = typeof r._ReflectorReader;
3+
export var reflector: typeof r.reflector = r.reflector;

0 commit comments

Comments
 (0)