fix(PrivateComponentLoader): add the loader to the app injector

fixes #1063
This commit is contained in:
Victor Berchet 2015-03-24 10:19:05 +01:00
parent 19c1773133
commit 65d759316b
4 changed files with 49 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import {StyleUrlResolver} from 'angular2/src/core/compiler/style_url_resolver';
import {StyleInliner} from 'angular2/src/core/compiler/style_inliner';
import {CssProcessor} from 'angular2/src/core/compiler/css_processor';
import {Component} from 'angular2/src/core/annotations/annotations';
import {PrivateComponentLoader} from 'angular2/src/core/compiler/private_component_loader';
var _rootInjector: Injector;
@ -107,6 +108,7 @@ function _injectorBindings(appComponentType): List<Binding> {
StyleUrlResolver,
StyleInliner,
bind(CssProcessor).toFactory(() => new CssProcessor(null), []),
PrivateComponentLoader,
];
}

View File

@ -24,6 +24,7 @@ import {StyleUrlResolver} from 'angular2/src/core/compiler/style_url_resolver';
import {ComponentUrlMapper} from 'angular2/src/core/compiler/component_url_mapper';
import {StyleInliner} from 'angular2/src/core/compiler/style_inliner';
import {CssProcessor} from 'angular2/src/core/compiler/css_processor';
import {PrivateComponentLoader} from 'angular2/src/core/compiler/private_component_loader';
import {If, For} from 'angular2/directives';
import {App, setupReflectorForApp} from './app';
@ -34,6 +35,8 @@ import {CompanyNameComponent, OpportunityNameComponent, OfferingNameComponent,
setupReflectorForCells}
from './cells';
import {EventManager} from 'angular2/src/core/events/event_manager';
export function main() {
setupReflector();
bootstrap(App);
@ -303,4 +306,17 @@ export function setupReflectorForAngular() {
"parameters": [],
"annotations": []
});
reflector.registerType(EventManager, {
"factory": () => new EventManager([], null),
"parameters": [],
"annotations": []
});
reflector.registerType(PrivateComponentLoader, {
"factory": (compiler, strategy, eventMgr, reader) =>
new PrivateComponentLoader(compiler, strategy, eventMgr, reader),
"parameters": [[Compiler], [ShadowDomStrategy], [EventManager], [DirectiveMetadataReader]],
"annotations": []
});
}

View File

@ -17,6 +17,7 @@ import {StyleUrlResolver} from 'angular2/src/core/compiler/style_url_resolver';
import {ComponentUrlMapper} from 'angular2/src/core/compiler/component_url_mapper';
import {StyleInliner} from 'angular2/src/core/compiler/style_inliner';
import {CssProcessor} from 'angular2/src/core/compiler/css_processor';
import {PrivateComponentLoader} from 'angular2/src/core/compiler/private_component_loader';
import {reflector} from 'angular2/src/reflection/reflection';
import {DOM} from 'angular2/src/dom/dom_adapter';
@ -30,6 +31,8 @@ import {XHRImpl} from 'angular2/src/core/compiler/xhr/xhr_impl';
import {If} from 'angular2/directives';
import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter';
import {EventManager} from 'angular2/src/core/events/event_manager';
function setupReflector() {
// TODO: Put the general calls to reflector.register... in a shared file
// as they are needed in all benchmarks...
@ -190,6 +193,19 @@ function setupReflector() {
"annotations": []
});
reflector.registerType(EventManager, {
"factory": () => new EventManager([], null),
"parameters": [],
"annotations": []
});
reflector.registerType(PrivateComponentLoader, {
"factory": (compiler, strategy, eventMgr, reader) =>
new PrivateComponentLoader(compiler, strategy, eventMgr, reader),
"parameters": [[Compiler], [ShadowDomStrategy], [EventManager], [DirectiveMetadataReader]],
"annotations": []
});
reflector.registerGetters({
'value': (a) => a.value,
'left': (a) => a.left,

View File

@ -19,6 +19,8 @@ import {StyleUrlResolver} from 'angular2/src/core/compiler/style_url_resolver';
import {ComponentUrlMapper} from 'angular2/src/core/compiler/component_url_mapper';
import {StyleInliner} from 'angular2/src/core/compiler/style_inliner';
import {CssProcessor} from 'angular2/src/core/compiler/css_processor';
import {EventManager} from 'angular2/src/core/events/event_manager';
import {PrivateComponentLoader} from 'angular2/src/core/compiler/private_component_loader';
import {reflector} from 'angular2/src/reflection/reflection';
@ -170,6 +172,19 @@ function setup() {
"annotations": []
});
reflector.registerType(EventManager, {
"factory": () => new EventManager([], null),
"parameters": [],
"annotations": []
});
reflector.registerType(PrivateComponentLoader, {
"factory": (compiler, strategy, eventMgr, reader) =>
new PrivateComponentLoader(compiler, strategy, eventMgr, reader),
"parameters": [[Compiler], [ShadowDomStrategy], [EventManager], [DirectiveMetadataReader]],
"annotations": []
});
reflector.registerGetters({
"greeting": (a) => a.greeting
});