feat(compiler): attach components and project light dom during compilation.
Closes #2529 BREAKING CHANGES: - shadow dom emulation no longer supports the `<content>` tag. Use the new `<ng-content>` instead (works with all shadow dom strategies). - removed `DomRenderer.setViewRootNodes` and `AppViewManager.getComponentView` -> use `DomRenderer.getNativeElementSync(elementRef)` and change shadow dom directly - the `Renderer` interface has changed: * `createView` now also has to support sub views * the notion of a container has been removed. Instead, the renderer has to implement methods to attach views next to elements or other views. * a RenderView now contains multiple RenderFragments. Fragments are used to move DOM nodes around. Internal changes / design changes: - Introduce notion of view fragments on render side - DomProtoViews and DomViews on render side are merged, AppProtoViews are not merged, AppViews are partially merged (they share arrays with the other merged AppViews but we keep individual AppView instances for now). - DomProtoViews always have a `<template>` element as root * needed for storing subviews * we have less chunks of DOM to clone now - remove fake ElementBinder / Bound element for root text bindings and model them explicitly. This removes a lot of special cases we had! - AppView shares data with nested component views - some methods in AppViewManager (create, hydrate, dehydrate) are iterative now * now possible as we have all child AppViews / ElementRefs already in an array!
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
<style>@import "angular2_material/src/components/button/button.css";</style>
|
||||
<span class="md-button-wrapper"><content></content></span>
|
||||
<span class="md-button-wrapper"><ng-content></ng-content></span>
|
||||
|
@ -4,5 +4,5 @@
|
||||
<div class="md-checkbox-container">
|
||||
<div class="md-checkbox-icon"></div>
|
||||
</div>
|
||||
<div class="md-checkbox-label"><content></content></div>
|
||||
<div class="md-checkbox-label"><ng-content></ng-content></div>
|
||||
</div>
|
||||
|
@ -64,7 +64,7 @@ export class MdDialog {
|
||||
// TODO(jelbourn): Don't use direct DOM access. Need abstraction to create an element
|
||||
// directly on the document body (also needed for web workers stuff).
|
||||
// Create a DOM node to serve as a physical host element for the dialog.
|
||||
var dialogElement = this.domRenderer.getRootNodes(containerRef.hostView.render)[0];
|
||||
var dialogElement = containerRef.location.nativeElement;
|
||||
DOM.appendChild(DOM.query('body'), dialogElement);
|
||||
|
||||
// TODO(jelbourn): Use hostProperties binding to set these once #1539 is fixed.
|
||||
@ -109,7 +109,7 @@ export class MdDialog {
|
||||
.then((componentRef) => {
|
||||
// TODO(tbosch): clean this up when we have custom renderers
|
||||
// (https://github.com/angular/angular/issues/1807)
|
||||
var backdropElement = this.domRenderer.getRootNodes(componentRef.hostView.render)[0];
|
||||
var backdropElement = componentRef.location.nativeElement;
|
||||
DOM.addClass(backdropElement, 'md-backdrop');
|
||||
DOM.appendChild(DOM.query('body'), backdropElement);
|
||||
return componentRef;
|
||||
|
@ -5,5 +5,5 @@
|
||||
</style>
|
||||
|
||||
<div class="md-grid-list">
|
||||
<content></content>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<style>@import "angular2_material/src/components/grid_list/grid-list.css";</style>
|
||||
|
||||
<figure>
|
||||
<content></content>
|
||||
<ng-content></ng-content>
|
||||
</figure>
|
||||
|
@ -58,7 +58,7 @@ md-radio-group {
|
||||
}
|
||||
}
|
||||
|
||||
// This is the style applied to the content (included via <content>). If we could rely on shadow
|
||||
// This is the style applied to the content (included via <ng-content>). If we could rely on shadow
|
||||
// DOM always being present, this would use the ::content psuedo-class.
|
||||
.md-radio-label {
|
||||
position: relative;
|
||||
|
@ -13,6 +13,6 @@
|
||||
|
||||
<!-- The label for radio control. -->
|
||||
<div class="md-radio-label">
|
||||
<content></content>
|
||||
<ng-content></ng-content>
|
||||
</div>
|
||||
</label>
|
||||
|
@ -1,2 +1,2 @@
|
||||
<style>@import "angular2_material/src/components/radio/radio-group.css";</style>
|
||||
<content></content>
|
||||
<ng-content></ng-content>
|
||||
|
@ -7,5 +7,5 @@
|
||||
<div class="md-switch-thumb"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-switch-label"><content></content></div>
|
||||
<div class="md-switch-label"><ng-content></ng-content></div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user