Future<ComponentRef> loadAsRoot(Type type, Injector injector, { String overrideSelector, OnDestroyCallback onDestroy, List<List> projectableNodes })

Creates an instance of a Component type and attaches it to the first element in the platform-specific global view that matches the component's selector.

In a browser the platform-specific global view is the main DOM Document.

If needed, the component's selector can be overridden via overrideSelector.

You can optionally provide injector and this Injector will be used to instantiate the Component.

To be notified when this Component instance is destroyed, you can also optionally provide onDispose callback.

Returns a promise for the ComponentRef representing the newly created Component.

Example

```
@Component(
  selector: 'child-component',
  template: 'Child'
)
class ChildComponent {
}
 
@Component(
  selector: 'my-app',
  template: 'Parent (<child id="child"></child>)'
)
class MyApp {
  constructor(dcl: DynamicComponentLoader, injector: Injector) {
    dcl.loadAsRoot(ChildComponent, injector,
        overrideSelector: '#child');
  }
}
 
bootstrap(MyApp);
```
 
Resulting DOM:
 
```
<my-app>
  Parent (
    <child id="child">Child</child>
  )
</my-app>
```

Source

Future<ComponentRef> loadAsRoot(Type type, Injector injector,
    {String overrideSelector,
    OnDestroyCallback onDestroy,
    List<List> projectableNodes});