Skip to content

Commit 70c7f07

Browse files
Merge branch 'Kamshak-2.0.0-fixes'
2 parents 30db03a + 30e1048 commit 70c7f07

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/ng2/directives/uiView.ts

Lines changed: 3 additions & 4 deletions
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";
@@ -26,12 +27,10 @@ interface InputMapping {
2627
prop: string;
2728
}
2829

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

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

src/ng2/private_import_core.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @Kamshak It's imported like this in @angular/compiler as well.
3+
* Was going to mark it injectable as in
4+
* https://github.com/angular/angular/blob/42a287fabf6b035d51e00cf3006c27fec00f054a/modules/%40angular/compiler/src/ng_module_resolver.ts
5+
* but unfortunately not all platforms (namely browser-dynamic) provide it.
6+
*/
7+
8+
import { __core_private__ as r} from '@angular/core';
9+
export type ReflectorReader = typeof r._ReflectorReader;
10+
export var reflector: typeof r.reflector = r.reflector;

0 commit comments

Comments
 (0)