BREAKING CHANGE:
- Renderer:
* renderComponent method is removed form `Renderer`, only present on `RootRenderer`
* Renderer.setDebugInfo is removed. Renderer.createElement / createText / createTemplateAnchor
now take the DebugInfo directly.
- Query semantics:
* Queries don't work with dynamically loaded components.
* e.g. for router-outlet: loaded components can't be queries via @ViewQuery,
but router-outlet emits an event `activate` now that emits the activated component
- Exception classes and the context inside changed (renamed fields)
- DebugElement.attributes is an Object and not a Map in JS any more
- ChangeDetectorGenConfig was renamed into CompilerConfig
- AppViewManager.createEmbeddedViewInContainer / AppViewManager.createHostViewInContainer
are removed, use the methods in ViewContainerRef instead
- Change detection order changed:
* 1. dirty check component inputs
* 2. dirty check content children
* 3. update render nodes
Closes#6301Closes#6567
Reflector always returns either an empty object or an empty list if no
metadata is recorded for the class. StaticReflector matches this
behavior.
Closes#7986
using "/// <reference" is incorrect because it makes our code non-portable. The correct solution is to provide
these typings as ambient typings as an additional entry point - which we already do.
Closes#8050
In Dart, ImmutableLists are just a projection of an underlying list.
I.e. if the underlying list changes, the ImmutableList also changes.
So we can't make optimizations based on checking whether a collection
is an ImmutableList.
This reverts commit a10c02cb41.
Closes#8023
Useful for avoiding doing an actual XHR during testing.
Part of the solution for #4051 (Other part is a Karma plugin that will create the template cache).
Closes#7940
Added a static reflector that uses metadta produced during build
or, additionally, directly from typescript, to produce the metadata
used by Angular code generation compiler.
Add a check in ReflectionCapabilities#interfaces which determines if
the passed-in type implements a Lifecycle Interface but does not declare
that it does so.
See https://goo.gl/b07Kii for details.
Closes#6849
fixes#6303
BREAKING CHANGE:
For static content projection, elements with *-directives are now matched against the element itself vs the template before.
<p *ngIf="condition" foo></p>
Before:
// Use the implicit template for projection
<ng-content select="template"></ng-content>
After:
// Use the actual element for projection
<ng-content select="p[foo]"></ng-content>
Closes#7742
Before, you'd get an error like:
```
EXCEPTION: Cannot find a differ supporting object ‘[object Object]’ in [users in UsersCmp@2:14]
```
Now, you get:
```
EXCEPTION: Cannot find a differ supporting object ‘[object Object]’ of type 'Object'. Did you mean to bind ngFor to an Array? in [users in UsersCmp@2:14]
```
At the moment ng-link is generating html5mode URLs for `href`s.
Instead it should check whether or not html5mode is enabled and create
the `href`s accordingly. The renaming in the `getLink` function is
aligning it to `RouterLink`'s `_updateLink`.
Closes#7423
Update the Angular 2 transformer to recognize
`package:angular2/platform/browser.dart` as the library which exports
the `bootstrap` function.
Update playground, examples, benchmarks, & tests to import bootstrap from
platform/browser.
Closes#7647
Change the old public api spec to check only the exported top-level symbols. This will make sure that Dart and JS do not diverge. The new public api spec verifies the TS api.
Closes#7447
TL;DR: Modify pubspec.yaml files to use the recommended "targeted"
transformers. The unified "simple" angular2 transformer still works as
always, but we want to encourage use of the targeted transformers
whereever possible.
See [the wiki](https://github.com/angular/angular/wiki/Advanced-Transformer-Configuration)
for details about targeted transformers.
See #1872
Until Angular 1.5.1 is released, the `$routeConfig` and `$routerCanActivate`
annotations for components must live on the controller constructor.
In Angular 1.5.1, it will automatically copy these annotations across from
the component definition file.
Closes#7319
These tests were registering new components after the application had
been bootstrapped, which is not a valid use case for synchronous routes
in Angular 1.
In particular it was registering the "root" component, which caused the
`$rootRouter` to blow up, when it was instantiated, pointing to a root
component that did not yet exist.
The directiveIntrospector was a bit of a hack to allow the router to
read the `$routeConfig` annocation and `$routerCanActivate` hook from
directives when they were registered.
It turns out that if we put these properties on the component controller's
constructor function (i.e. as static class methods) then we can simply
use the `$injector` to access it as required.
Currently, people put the properties directly on their component definition
objects. In Angular 1.5.1, we will copy these properties onto the controller
constructor to maintain a simple migration path. But going forward it may be
better to encourage people to add the properties directly to the controller
constructor.
Create transformers that allow specifying transformer actions on
specific libraries.
* angular2/transform/codegen: Generates all necessary code.
* angular2/transform/reflection_rewriter: Replaces `bootstrap` calls in
application entry points to remove transitive dart:mirrors import,
resulting in smaller code size & faster execution.
* angular2/transform/deferred_rewriter: Rewrites deferred imports and
`loadLibrary` calls to initialize Angular2 and preserve deferred
operation.
Proper configuration of these three transformers can replace the single
angular2 transformer, resulting in significant performance gains for
builds of large angular2 apps.
Update angular2 itself to declare the codegen transformer, since it has
neither deferred imports nor application entry points.
Remove the undocumented & unused quick_transformer.
Instead of running with karma and the karma-dart shim, run dart
tests directly using the new package:test runner. This migrates
away from package:unittest.
Fixes a couple tests, mostly associated with depending on absolute
URLs or editing the test providers after an injector had already
been created.
Remove karma-dart and associated files. Change gupfiles to run tests
via `pub run test` instead.
Add a check in `ReflectionCapabilities#interfaces` which determines if
the passed-in type implements a Lifecycle Interface but does not declare
that it does so.
See https://goo.gl/b07Kii for details.
Closes#6849
Remove couple of circular dependency between modules in Angular 2 ES5 output caused by exception_handler.ts and router_providers.ts.
Fix the build/checkCircularDependency gulp task to call madge properly to detect the circular deps.
Closes#7287
@petebacondarwin deserves credit for most of this commit.
This allows you to specify a regex and serializer function instead
of the path DSL in your route declaration.
```
@RouteConfig([
{ regex: '[a-z]+.[0-9]+',
serializer: (params) => `{params.a}.params.b}`,
component: MyComponent }
])
class Component {}
```
Closes#7325Closes#7126
The current router is passed to the current component via a binding.
To indicate that this is an angular provided object, this commit
renames the binding to `$router`.
BREAKING CHANGE:
The recently added binding of the current router to the current component
has been renamed from `router` to `$router`.
So now the recommended set up for your bindings in your routed component
is:
```js
{
...
bindings: {
$router: '<'
}
}
```
The current router is passed to the current component via a binding.
To indicate that this is an angular provided object, this commit
renames the binding to `$router`.
BREAKING CHANGE:
The recently added binding of the current router to the current component
has been renamed from `router` to `$router`.
So now the recommended set up for your bindings in your routed component
is:
```js
{
...
bindings: {
$router: '<'
}
}
```
BREAKING CHANGE:
`OnPushObserve` was an experimental
feature for Dart and had
conceptual performance problems,
as setting up observables is slow.
Use `OnPush` instead.
BREAKING CHANGE:
In Dart we used to support injecting types with generics. As this feature is hard to implement with the upcoming codegen we are dropping it.
Merge cl/115454020 in G3 with this change.
Closes#7262
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
feat(pipes): add ReplacePipe for string manipulation
add commonly used pipe that is missing from framework.
Adding static pattern validation method to Validators
Adding a directive for the pattern validator
Applying clang-format rules to modified files
Updating public api spec for new pattern validator
Adding pattern validator to public api guard tool
For #5411Closes#5561
The singleton service that represents the top level router was called
`$router` but this is confusing since there are actually lots of routers,
which depend upon where you are in the DOM. This is similar to the situation
with scopes.
This commit clarifies this singleton by renaming it to `$rootRouter`.
BREAKING CHANGE:
The `$router` injectable service has been renamed to `$rootRouter`
The current router is passed to the current component via a binding.
To indicate that this is an angular provided object, this commit
renames the binding to `$router`.
BREAKING CHANGE:
The recently added binding of the current router to the current component
has been renamed from `router` to `$router`.
So now the recommended set up for your bindings in your routed component
is:
```js
{
...
bindings: {
$router: '<'
}
}
```
Despite local testing, multiple users failed to run the postinstall to install typings.
Instead, we can distribute the typings we installed locally.
This is an alternative to #7003.
This also reverts rxjs to beta.1 since we have errors using beta.2, being addressed
in #7001.
Fixes#7000
Currently, validators extending built-in validators are treated as built-in.
This can result in an error when both a real built-in validator and a custom one are applied to the same element.
Closes#6981
Url path of star segments should equal the original path.
If you register the route `/app/*location` and invoke a url like `/app/foo/bar`
the PathRecognizer should return a url path equal to the invoked url.
Before this patch, everything after `foo` was ignored, which resulted in a
redirect to `/app/foo` which was probably not intended (at least in the angular
1.5 component router).
Closes#6976
In angular2 `Location.path()` returns the complete path including query string. In angular1 the query parameters are missing. Similar to this `Location.go` does accept two parameters (path *and query*).
Closes#6943
In Angular 1.5 there is a new helper method for creating component directives.
See https://docs.angularjs.org/guide/component for more information about components.
These kind of directives only match the `E` element form and the previously component
router only created HTML that matched directives that matched the `A` attribute form.
This commit changes the `<ng-outlet>` directive so that it generates custom HTML
elements rather divs with custom attributes to trigger the relevant component to
appear in the DOM.
Going forward, Angular 1.5 users are encouraged to create their router components
using the following style:
```
myModule.componnet('component-name', {
// component definition object
});
```
Closes angular/angular.js#13860
Closes#6076Closes#5278
BREAKING CHANGE:
The component router now creates custom element HTML rather than custom attribute
HTML, in order to create a new component. So rather than
```html
<div custom-component></div>
```
it now creates
```html
<custom-component></custom-component>
```
If you defined you router components using the `directive()` helper and
specified the `restrict` properties such that element matching was not allowed,
e.g. `restrict: 'A'` then these components will no longer be instantiated
by the component router and the outlet will be empty.
The fix is to include `E` in the `restrict` property.
`restrict: 'EA'`
Note that this does not affect directives that did not specify the `restrict`
property as the default for this property is already `EA`.