currently throwing an error
```error
Error during instantiation of LocationStrategy! (RouterLink -> Router
-> Location -> LocationStrategy).
ORIGINAL ERROR: TypeError: baseElement.attr is not a function
```
Closes#3214
Provide the ability to attach custom data onto a route and retrieve
that data as an injectable (RouteData) inside the component.
Closes#2777Closes#3541
BREAKING CHANGE (maybe)
Well as long as our customers use public API this should not be a
breaking change, but we have changed import structure as well as
internal names, so it could be breaking.
import:
angular2/annotations => angular2/metadata
Classes:
*Annotations => *Metadata
renderer.DirectiveMetadata => renderer.RendererDirectiveMetadata
renderer.ElementBinder => renderer.RendererElementBinder
impl.Directive => impl.DirectiveMetadata
impl.Component => impl.ComponentMetadata
impl.View => impl.ViewMetadata
Closes#3660
BREAKING CHANGE
Stop supporting http module in Dart. This is because Dart has a
well developed http package which should be used by Dart
customers instead.
Find angular testability objects across different dart js contexts by
registering each application in a global array and interrogating each
for testabilities.
Closes#3611
This makes it simple to run the `tsd link` command in a project
to automatically include paths to typings files. The definitions
also include transitive dependencies of rx.d.ts and es6-promise.d.ts.
Closes#3590Closes#3609
Fixes a bug in view manager util where sibling injector is not correctly
calculated.
ViewQuery no longer includes the view's initiating component injector.
Includes some refactoring of view methods and a removal of a polymorphic
map call.
Closes#3033Closes#3439
BREAKING CHANGE:
Instead of configuring pipes via a Pipes object, now you can configure them by providing the pipes property to the View decorator.
@Pipe({
name: 'double'
})
class DoublePipe {
transform(value, args) { return value * 2; }
}
@View({
template: '{{ 10 | double}}'
pipes: [DoublePipe]
})
class CustomComponent {}
Closes#3572
- Extends URLSearchParams API to include operations for combining
different URLSearchParams objects:
These new methods include:
setAll(otherParams): performs `this.set(key, values[0])` for each
key/value-list pair in `otherParams`
appendAll(otherParams): performs `this.append(key, values)` for
each key/value-list pair in `otherParams`
replaceAll(otherParams): for each key/value-list pair in
`otherParams`, replaces current set of values for `key` with
a copy of the list of values.
- RequestOptions do not merge search params automatically (because
there are multiple ways to do this). Instead, they replace any
existing `search` field if `search` is provided. Explicit merging
is required if merging is desirable.
- Some extra test coverage added.
Closes#2417Closes#3020
Allows declaring a bundle's namespace in generated typings file,
which should correspond to the global object representing the module
inside its bundle.
BREAKING CHANGE
The router was previously exported as ng.router in the
angular.sfx.dev.js bundle, but now it is exported as ngRouter.
Closes#2948Closes#3544
This fixes the following type error that is thrown when calling getAllAngularTestability() while running Dartium in checked mode:
type 'MappedListIterable' is not a subtype of type 'List<PublicTestability>' of 'publicTestabilities'.
BREAKING CHANGE
- Pipe factories have been removed.
- PIpe names to pipe implementations are 1-to-1 instead of 1-to-*
Before:
class DateFormatter {
transform(date, args){}
}
class DateFormatterFactory {
supporst(obj) { return true; }
create(cdRef) { return new DateFormatter(); }
}
new Pipes({date: [new DateFormatterFactory()]})
After
class DateFormatter {
transform(date, args){}
}
new Pipes({date: DateFormatter})
BREAKING CHANGE:
The selector for the CSSClass directive was changed
from [class] to [ng-class]. The directive itself was
renamed from CSSClass to NgClass
Closes#3498
This requires delicate handling of type definitions which collide, because
we use TypeScript-provided lib.d.ts for --target=es5 and lib.es6.d.ts for
--target=es6.
We need to include our polyfill typings only in the --target=es5 case,
and the usages have to be consistent with lib.es6.d.ts.
Also starting with this change we now typecheck additional modules,
so this fixes a bunch of wrong typings which were never checked before.
Fixes#3178
Formatting code requires time and memory during the build -- do not do
it unless explicitly requested via a parameter to the transformer.
Add an entry to the
[wiki](https://github.com/angular/angular/wiki/Angular-2-Dart-Transformer)
describing the added parameter.
Previously, the error messages coming out of the Dart transformer were
opaque when those errors came from the analyzer (for example, analyzer
parse errors). Log more useful errors when they are caught by the
transform code.
Previously I added parens everywhere to make this @proxy() because our typing indicated
it was a function that returned a decorator, but this breaks dart. Instead, the typing needs
to be changed.
Fixes#3494
Promise used to be typed as any, giving incorrect results. This change
fixes places that were incorrectly typed and re-exports the actual
Promise type from es6-promise.
It also fixes a series of compilation errors discovered/triggered by
this change.
BREAKING CHANGE
Previously, if an element had a property, Angular would update that property even if there was a directive placed on the same element with the same property. Now, the directive would have to explicitly update the native elmement by either using hostProperties or the renderer.
This change also makes us compliant with 1.6.0-dev compiler,
so we can do some experiments with apps that use 1.6 features
and compile against Angular.
We should probably add a travis build for 1.6 so we stay compatible
with both versions.
Introduces the injectable `TemplateCloner` that can be configured via the new token `MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN`.
Also replaces `document.adoptNode` with `document.importNode` as otherwise
custom elements are not triggered in chrome 43.
Closes#3418Closes#3433
BREAKING CHANGE:
Replace @Ancestor() with @Host() @SkipSelf()
Replace @Unbounded() wwith @SkipSelf()
Replace @Ancestor({self:true}) with @Host()
Replace @Unbounded({self:true}) with nothing
Replace new AncestorMetadata() with [new HostMetadata(), new SkipSelfMetadata()]
Replace new UnboundedMetadata() with new SkipSelfMetadata()
Replace new Ancestor({self:true}) with new HostMetadata()
LifeCycle can now be imported via angular2/angular2 or
angular2/core, so that end users can inject it without
having to use the full source path.
Closes#3395
Also inserts comment nodes before/after projected nodes so that text nodes don’t get merged when we serialize/deserialize them.
Closes#3356
First part of #3364
Move the implementation of `(de)hydrate`, `hydrated`, and
`detectChangesInRecords` into `AbstractChangeDetector`.
Add comments clarifying the contract between `AbstractChangeDetector`
and its subclasses.
Closes#3245
Move fields common to Dynamic, Jit, and Pregen change detectors into the
`AbstractChangeDetector` superclass to save on codegen size and reduce
code duplication.
Update to #3248, closes#3243
BREAKING CHANGES:
- `ShadowDomStrategy` was removed. To specify the encapsulation of a component use `@View(encapsulation: ViewEncapsulation.NONE | ViewEncapsulation.EMULATED | ViewEncapsulation.NATIVE)`
- The default encapsulation strategy is now `ViewEncapsulation.EMULATED` if a component contains styles and `ViewEncapsulation.NONE` if it does not. Before this was always `NONE`.
- `ViewLoader` now returns the template as a string and the styles as a separate array
Call new `(de)hydrateDirectives` methods from `(de)hydrate`. Add a null
implementation in `AbstractChangeDetector` and only override if
necessary for the specific change detector.
Update to #3248
Create `looseNotIdentical => !looseIdentical`, which will save a lot of
unnecessary '!' characters in generated change detectors.
Update to https://github.com/angular/angular/issues/3248
Reverted from commit 35597a8349
This style change makes the docs look nicer but clang-format doesn't
like it. @mhevery perhaps we can tweak the clang-format rules for this?
Previously, `uninitialized()` was a method, requiring a call as well as
two extra characters everywhere it was used.
Make this value a variable, saving the characters and avoiding the
method call to get its value.
This change also removes the export of `uninitialized` from
change_detect.ts, which is technically a breaking change, however
`uninitialized` is an implementation detail and nobody should be using
it in app logic. By convention, apps should not be importing from files
under `src/`.
Update to #3248.
Fixes#3001
BREAKING CHANGE:
View renderer used to take normalized CSS class names (ex. fooBar for foo-bar).
With this change a rendered implementation gets a calss name as specified in a
template, without any transformations / normalization. This change only affects
custom view renderers that should be updated accordingly.
Closes#3264
Create `NameRegistry`, responsible for understanding how names are
generated for change detector fields and variables.
Use `NameRegistry` for both JS Jit & Dart pre-generated detectors.
Making progress on #3248
Previously, the compiler would detect cycles where there were none just because of other components that were compiled in parallel. Furthermore, the way ProtoView merging was triggered could result into early exits resulting in errors when trying to instantiate ProtoViews.
Fixes#3206Closes#3211
BREAKING CHANGE
Previously it was possible to pass a custom error reporter to bootstrap, which was used only during the construction of Injector. This had limited utility, so this capability has been removed.
BREAKING CHANGES:
Dart applications and TypeScript applications meant to transpile to Dart must now
import `package:angular2/bootstrap.dart` instead of `package:angular2/angular2.dart`
in their bootstrap code. `package:angular2/angular2.dart` no longer export the
bootstrap function. The transformer rewrites imports of `bootstrap.dart` and calls
to `bootstrap` to `bootstrap_static.dart` and `bootstrapStatic` respectively.
When a `Directive` implements a lifecycle interface (e.g. `OnChange` or
`OnInit`), populate its `lifecycle` property if not already populated).
Closes#3181
Static binary component tree of depth 10, i.e. 1024 components.
Current numbers for `pureScriptTime` are:
JavaScript:
Baseline: 27.10+-9%
Ng2: 26.84+-8%
Ng1: 55.30+-14%
Dart:
Baseline: 30.13+-4%
Ng2: 45.94+-3%
Ng1: 128.88+-10%
I.e. in JS we are same speed as baseline right now!
Some background: We had a recent change in the compiler that merges components into their parents already during compilation (#2529). This made Ng2 2x faster in this benchmark (before the Ng2 JS time was 49.59+-14%ms).
Closes#3196