When a `Directive` implements a lifecycle interface (e.g. `OnChange` or
`OnInit`), populate its `lifecycle` property if not already populated).
Closes#3181
BREAKING CHANGE
The @Parent annotation has been removed. Use @Ancestor instead.
@Parent was used to enforce a particular DOM structure (e.g., a pane component is a direct child of the tabs component).
DI is not the right mechanism to do it. We should enforce it using schema instead.
The Angular 2 render compiler can get out of sync between its transformer
execution and its runtime execution, leading to incorrect change detectors with
out-of-order property values. Stable sorting solves this problem (temporarily).
Angular fetches template HTML files outside of the browser's normal parsing flow. As a result, URLs in template files are interpreted relative to the root application, when the components defined by the template files are inserted into the DOM. This change enables a template author to prefix URLs with the string $baseUrl, which will be replaced with the relative base path of the template file.
So for an example template loaded from /component/foo/template.html:
<img src="$baseUrl/logo.png" />
becomes:
<img src="/component/foo/logo.png" />
Addresses #2384.
Due to #3019 we have to check whether a property exists on a DOM element
not before runtime of the application.
Previously, we did this check in JavaScript, making all property values
go through dart js interop. However, this is slow for complex objects.
This commit changes this behavior to first check whether the property exists
before sending the property value to the DOM element via js interop.
Closes#3149
Previously, calls to getBaseHref used document.baseURI, which defaults
to the current path in the absence of a base element in the document.
This leads to surprising behavior.
With this change, getBaseHref returns null when a base element is not
present in the document.
Implement deferred libraries to work with dependency injection and other
angular codegen. This is done by not initializing the library in the parent
ng_deps file when it is declared as deferred, rewriting the import and,
chaining a future that initializes the library in any files that are using
deferred libraries which need angular codegen.
BREAKING CHANGES:
`ViewManager.createView` / `ViewContainerRef.create` have been split into 2 methods:
- `createHostView` which takes dynamically created bindings
- `createEmbeddedView` which takes the newly introduced `TemplateRef`
The new type `TemplateRef` is the combination of a `ProtoViewRef` and and `ElementRef`
from the same place. Use `TemplateRef` when working with embedded views in
`ng-if`, `ng-for`, ... instead of `ProtoViewRef`.
Also, `ProtoViewRef` is no more injectable, but `TemplateRef` is.
First part of #1989 to clean up manual content projection.
Closes#3114
Fix sort order for reflective imports in reflection_remover/rewriter.dart.
Currently there is only one import so the sort order happens to be correct,
but if another one is added the rewrite code will break.
Remove reflector parameter from initReflector method to simplify ng_deps for reflection
initialization. It wasn't used and was added for testability, but wasn't used. This
keeps the interface simplier.
In Dart, '$' indicates the beginning of an interpolation.
- Escapes '$' in strings when generating change detector classes.
- Adds a unit test to cover this case.
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!