bootstrapAngular(modules, [rootElementSelector = '[ng-app]',
Injector injectorFactory(List<Module> modules) = _defaultInjectorFactory]) {
var allModules = new List.from(modules);
List<dom.Node> topElt = dom.query(rootElementSelector).nodes.toList();
assert(topElt.length > 0);
// The injector must be created inside the zone, so we create the
// zone manually and give it back to the injector as a value.
Zone zone = new Zone();
allModules.add(new Module()..value(Zone, zone));
return zone.run(() {
Injector injector = injectorFactory(allModules);
injector.get(Compiler)(topElt)(injector, topElt);
return injector;
});
}