BREAKING CHANGE:
Previously, pipes that wanted to be notified when they were destroyed
would implement the PipeOnDestroy interface and name the callback
`onDestroy`. This change removes the PipeOnDestroy interface and
instead uses Angular's lifecycle interface `OnDestroy`, with the
`ngOnDestroy` method.
Before:
```
import {Pipe, PipeOnDestroy} from 'angular2/angular2';
@Pipe({pure: false})
export class MyPipe implements PipeOnDestroy {
onDestroy() {}
}
```
After:
import {Pipe, OnDestroy} from 'angular2/angular2';
@Pipe({pure: false})
export class MyPipe implements PipeOnDestroy {
ngOnDestroy() {}
}
BREAKING CHANGE:
Previously, components that would implement lifecycle interfaces would include methods
like "onChanges" or "afterViewInit." Given that components were at risk of using such
names without realizing that Angular would call the methods at different points of
the component lifecycle. This change adds an "ng" prefix to all lifecycle hook methods,
far reducing the risk of an accidental name collision.
To fix, just rename these methods:
* onInit
* onDestroy
* doCheck
* onChanges
* afterContentInit
* afterContentChecked
* afterViewInit
* afterViewChecked
* _Router Hooks_
* onActivate
* onReuse
* onDeactivate
* canReuse
* canDeactivate
To:
* ngOnInit,
* ngOnDestroy,
* ngDoCheck,
* ngOnChanges,
* ngAfterContentInit,
* ngAfterContentChecked,
* ngAfterViewInit,
* ngAfterViewChecked
* _Router Hooks_
* routerOnActivate
* routerOnReuse
* routerOnDeactivate
* routerCanReuse
* routerCanDeactivate
The names of lifecycle interfaces and enums have not changed, though interfaces
have been updated to reflect the new method names.
Closes#5036
Use a zone counting timeouts and microtasks to determine when a test
is finished, instead of requiring the test writer to use
injectAsync and return a promise.
See #5322
This is a big change. @matsko also deserves much of the credit for the implementation.
Previously, `ComponentInstruction`s held all the state for async components.
Now, we introduce several subclasses for `Instruction` to describe each type of navigation.
BREAKING CHANGE:
Redirects now use the Link DSL syntax. Before:
```
@RouteConfig([
{ path: '/foo', redirectTo: '/bar' },
{ path: '/bar', component: BarCmp }
])
```
After:
```
@RouteConfig([
{ path: '/foo', redirectTo: ['Bar'] },
{ path: '/bar', component: BarCmp, name: 'Bar' }
])
```
BREAKING CHANGE:
This also introduces `useAsDefault` in the RouteConfig, which makes cases like lazy-loading
and encapsulating large routes with sub-routes easier.
Previously, you could use `redirectTo` like this to expand a URL like `/tab` to `/tab/posts`:
@RouteConfig([
{ path: '/tab', redirectTo: '/tab/users' }
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
Now the recommended way to handle this is case is to use `useAsDefault` like so:
```
@RouteConfig([
{ path: '/tab', component: TabsCmp, name: 'Tab' }
])
AppCmp { ... }
@RouteConfig([
{ path: '/posts', component: PostsCmp, useAsDefault: true, name: 'Posts' },
{ path: '/users', component: UsersCmp, name: 'Users' }
])
TabsCmp { ... }
```
In the above example, you can write just `['/Tab']` and the route `Users` is automatically selected as a child route.
Closes#4728Closes#4228Closes#4170Closes#4490Closes#4694Closes#5200Closes#5475
Currently the main sfx bundle already contains http and router
and the http sfx bundles duplicates all core.
Additionally https://github.com/angular/angular/issues/5223
modifies our strategy for individual bundles
Closes#5434
A quoted expression is:
quoted expression = prefix `:` uninterpretedExpression
prefix = identifier
uninterpretedExpression = arbitrary string
Example: "route:/some/route"
Quoted expressions are parsed into a new AST node type Quote. The `prefix` part of the
node must be a legal identifier. The `uninterpretedExpression` part of the node is an
arbitrary string that Angular does not interpret.
This feature is meant to be used together with template AST transformers introduced in
a43ed79ee7. The
transformer would interpret the quoted expression and convert it into a standard AST no
longer containing quoted expressions. Angular will continue compiling the resulting AST
normally.
BREAKING CHANGE
Before
import * as p from 'angular2/profile';
import * as t from 'angular2/tools';
After
import * as p from 'angular2/instrumentation';
import * as t from 'angular2/platform/browser';
This reverts commit cf7292fcb1.
This commit triggered an existing race condition in Google code. More work is needed on the Router to fix this condition before this refactor can land.
BREAKING CHANGE:
previously http would only error on network errors to match the fetch
specification. Now status codes less than 200 and greater than 299 will
cause Http's Observable to error.
Closes#5130.
Import dependencies from `angular2/angular2.dart` in `hello_world` to
ensure that any size regressions are caught by our checks.
Update to avoid regressions like #5419.
Closes#5394