Previously, if a `TemplateRef` was created in a `ViewContainerRef`
at a different place, the content was not query able at all.
With this change, the content of the template can be queried
as if it was stamped out at the declaration place of the template.
E.g. in the following example, the `QueryList<ChildCmp>` will
be filled once the button is clicked.
```
@Component({
selector: ‘my-comp’,
template: ‘<button #vc (click)=“createView()”></button>’
})
class MyComp {
@ContentChildren(ChildCmp)
children: QueryList<ChildCmp>;
@ContentChildren(TemplateRef)
template: TemplateRef;
@ViewChild(‘vc’, {read: ViewContainerRef})
vc: ViewContainerRef;
createView() {
this.vc.createEmbeddedView(this.template);
}
}
@Component({
template: `
<my-comp>
<template><child-cmp></child-cmp></template>
</my-comp>
`
})
class App {}
```
Closes#12283Closes#12094
But use the DOM apis directly.
This also creates a separate `ServerRenderer` implementation
for `platform-server` as it previously reused the `BrowserRenderer`.
BREAKING CHANGE:
- all `…Metadata` classes have been removed. Use the corresponding decorator
as constructor or for `instanceof` checks instead.
- Example:
* Before: `new ComponentMetadata(…)`
* After: `new Component(…)`
- Note: `new Component(…)` worked before as well.
Every decorator now is made of the following:
- a function that can be used
as a decorator or as a constructor. This function
also can be used for `instanceof` checks.
- a type for this function (callable and newable)
- a type that describes the shape of the data
that the user needs to pass to the decorator
as well as the instance of the metadata
The docs for decorators live at the followig places
so that IDEs can discover them correctly:
- General description of the decorator is placed on the
`...Decorator` interface on the callable function
definition
- Property descriptions are placed on the interface
that describes the metadata produces by the decorator
When lazily loading code, users need to be able to get hold of the
NgModuleFactory. For SystemJS environments, the SystemJS registry serves
this purpose. However other environments, such as modules compiled with
Closure compiler, do not expose exports object or a path based registry.
For these environments, `@NgModule` objects can include an identifier, and
the loading code can then pass `loadModule(id).then(() =>
getNgModule(id))` to the router.
closes#11145
Also rename `CompileIdentifierMetadata.runtime` into `CompileIdentifierMetadata.reference`.
Also remove `CompileIdentifierMetadata.equalsTo` as
now it is enough to just check the `reference` fields for equality.