This improves ergonomics a bit by allowing people to write:
`<label [for]="ctxProp"></label>`.
This is similar to the existing class -> className mapping.
Closes#7516
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
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.
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.
BREAKING CHANGE:
Exceptions are no longer part of the public API. We don't expect that anyone should be referring to the Exception types.
ExceptionHandler.call(exception: any, stackTrace?: any, reason?: string): void;
change to:
ErrorHandler.handleError(error: any): void;
BREAKING CHANGE: previously deprecated @Component.directives and @Component.pipes support was removed.
All the components and pipes now must be declarated via an NgModule. NgModule is the basic
compilation block passed into the Angular compiler via Compiler#compileModuleSync or #compileModuleAsync.
Because of this change, the Compiler#compileComponentAsync and #compileComponentSync were removed as well -
any code doing compilation should compile module instead using the apis mentioned above.
Lastly, since modules are the basic compilation unit, the ngUpgrade module was modified to always require
an NgModule to be passed into the UpgradeAdapter's constructor - previously this was optional.