Releases: angulardart/angular
pkg:angular v6.0.0
angular-v6.0.0
6.0.0-alpha+1
angular
6.0.0-alpha+1
New features
-
Added
ComponentRef.update()
. This method should be used to apply changes
to a component and then trigger change detection. Before this, change
detection and lifecycles would not always follow Angular's specifications
when imperatively loading a component, especialy for those using the OnPush
change detection strategy.final componentRef = componentFactory(); componentRef.update((component) { component.input = newValue; });
-
Added
@changeDetectionLink
topackage:angular/experimental.dart
.This annotation allows a component that imperatively loads another component
from a user-provided factory to adopt the OnPush change detection strategy,
without dictacting the change detection strategy of the component created
from the factory. This allows such a component to be used in both Default
and OnPush apps.An annotated component will serve as a link between an ancestor and an
imperatively loaded descendant that both use the Default change detection
strategy. This link is used to change detect the descendant anytime the
ancestor is change detected, thus honoring its Default change detection
contract. Without this annotation, the descendant would be skipped anytime
the annotated OnPush component had not been marked to be checked.For more details, see this annotation's documentation.
angular_test
2.4.0
New Features
-
Added an optional named parameter,
maxIterations
, to
FakeTimeNgZoneStabilizer
's constructor. If not specified 10 maximum loops
are attempted toelapse
pending timers. In advanced use cases, a test may
configure a higher threshold:NgZoneStabilizer allow100InsteadOf10() { return FakeTimeNgZoneStabilizer(timerZone, ngZone, maxIterations: 100); }
Bug Fixes
NgTestFixture.update()
now delegates toComponentRef.update()
, which
automatically callsmarkForCheck()
. Previously, anOnPush
component
under test might not have been properly updated.
angular_forms
2.1.4
- Maintenance release to support Angular 6.0-alpha+1.
angular_router
2.0.0-alpha+24
- Maintenance release to support Angular 6.0-alpha+1.
angular_compiler
0.4.5
-
The InjectorReader now fails with an explicit error if types are used inside
a ValueProvider object. Previously, using types in ValueProviders would
crash the AngularDart compiler.Instead of a ValueProvider, use a FactoryProvider for complicated objects,
such as those that contain types. -
Removed the
i18n
compiler flag that was previously used to opt-in to
internationalization in templates before the feature had stabilized. -
Added support for a command-line flag,
allowed_typedefs_as_di_token
. This
is intended to be used as a transitional flag to ban using atypedef
as a
DI token (which has non-predictable properties in Dart 2). -
Added
$ChangeDetectionLink
, a type checker for matching the experimental
@changeDetectionLink
annotation.
angular_ast
0.5.11
- Maintenance release to support Dart 2.5 dev.
angular_analyzer_plugin
1.0.0-alpha+1
- Maintenance release to support Angular 6.0-alpha+1.
5.3.1
6.0.0-alpha
angular
6.0.0-alpha
Breaking changes
-
The
OnChanges
lifecycle has been completely removed. UseAfterChanges
instead. -
ExceptionHandler
is no longer exported viaangular/di.dart
. Import this
symbol viaangular/angular.dart
instead. -
Directives no longer support extending, implementing, or mixing in
ComponentState
. -
The
/deep/
and>>>
combinators are no longer supported in style sheets
of components with style encapsulation enabled. The special::ng-deep
pseudo-element should be used in their stead to pierce style encapsulation
when necessary. -
ChangeDetectorRef.checkNoChanges()
has been removed from the public API.
Deprecations
- Deprecated
ChangeDetectorRef.detach()
andChangeDetectorRef.reattach()
.
Components that rely on these methods should usechangeDetection: ChangeDetectionStrategy.OnPush
instead.
angular_test
2.3.1
- Maintenance release to support Angular 6.0-alpha.
angular_forms
2.1.3
- Maintenance release to support Angular 6.0-alpha.
angular_router
2.0.0-alpha+23
Bug fixes
-
Navigation requests triggered by
popstate
events that redirect back to the
active route will now correctly update the browser location to match the
active route. Prior to this fix, the browser location would be left in the
state changed by thepopstate
event. -
The history stack prior to the current entry is now preserved when
preventing a navigation triggered by the back button. Previously, preventing
such a navigation would erase the previous history entry, causing subsequent
history manipulations to have unexpected results.
angular_analyzer_plugin
1.0.0-alpha
- The Angular analyzer plugin has moved into the core angular repo, and will be
developed by the Angular team going forward.
angular_compiler
0.4.4
- Maintenance release to support the newest version of
analyzer
.
angular_ast
0.5.10
- New
ThrowingTemplateAstVisitor
which throws by default in each visit
method.
5.3.0
angular
5.3.0
New features
-
The template compiler issues a warning if a component that does not project
content has children. Previously, these nodes were created and never
attached. Now the nodes are not created at all. -
Specialized interpolation functions for Strings.
-
Optimization: Removes toString() calls of interpolated strings bound to
properties. -
The compiler now uses superclass information to determine immutability.
-
Added
Injector.provideTypeOptional
andInjector.provideTokenOptional
. -
The compiler now optimizes string bindings inside
NgFor
loops. -
The compiler now adds type information to local variables in nested
NgFor
loops. -
The compiler now includes source locations to errors in annotations on class
members. -
The compiler now optimizes change detection for HTML Text nodes.
-
Disabled an optimization around pure-HTML DOM nodes wrapped in a
*ngIf
. In
practice this optimization only kicked in for a few views per application
and had a high runtime cost as well as a high overhead for the framework
team. We have added and expect to add additional optimizations around the
size of generated views.
Bug fixes
-
The template compiler now outputs the full path to a template file when it
reports an error. -
#1694: Composite
keyup
andkeydown
event bindings now ignore
synthetic events (e.g. those triggered by a mouse click) instead of throwing
aTypeError
. -
#1669: Fixed a regression which prevented a pipe invoked with more than
two arguments from being passed as an argument to a function. -
The compiler emits source locations for errors in Dart files when using an
AnalysisDriver
. -
Internationalized attribute, property, and input bindings will now properly
escape characters in the message that would invalidate the generated string
(such as\n
,$
, and'
). This behavior is now consistent with
internationalized text and HTML. -
The template compiler no longer crashes on HTML attributes ending in ":"
-
When querying for a directive present in multiple embedded views (portions
of the template controlled by a structural directive such as*ngIf
) with
@ViewChildren()
, the directives in the resulting list are now in the same
order as they appear in the template. Prior to this fix, directives in
nested embedded views would occur before those in their parent view. -
The template compiler now properly updates class statements for "literal
attributes". Previously, we did not shim these classes correctly. This
includes both raw attributes (e.g.class="foo"
) and host bindings (e.g.
@HostBinding('class')
). -
The presence of a query (e.g.
@ContentChild(TemplateRef)
) no longer causes
any matching<template>
references to become available for dynamic
injection (i.e.injector.provideType(TemplateRef)
). -
The template compiler now properly updates class bindings on SVG elements.
Previously, we did not shim these classes correctly. -
When using
runAppAsync
,beforeComponentCreated
now runs withinNgZone
which previously surfaced bugs when services created and initialized in this
callback did not trigger change detection. -
The style sheet compiler will no longer emit invalid Dart code when a style
sheet is placed within a directory whose name is not a valid Dart
identifier. -
The template compiler will now report a helpful error message when an
@i18n.skip
annotation has no corresponding@i18n
description, instead of
throwing an unhandled error.
Breaking changes
-
Removed
castCallback2ForDirective
frommeta.dart
. In practice this was
not used. We also deprecatedcastCallback1ForDirective
now that the
directiveTypes: [ ... ]
feature is live. -
Removed deprecated
AppViewUtils.resetChangeDetection()
. This method was
never intended to be used in the public API, and is no longer used by our
own infra. -
Using anything but
ChangeDetectionStrategy.{Default|OnPush}
is considered
deprecated, as they were not intended to be publicly accessible states.
See the deprecation messages for details. -
ViewContainerRef.get()
now returns aViewRef
instead of an
EmbeddedViewRef
.For context,
ViewContainerRef
supports inserting both host views (created
viaComponentFactory
) and embedded views (created viaTemplateRef
).
Today,EmbeddedViewRef
can reference either kind of view, but in the
future it will only reference the latter, for which its methods are actually
relevant (for example setting locals has no purpose on host views). This
change is in preperation for when a host view reference may not implement
EmbeddedViewRef
.
Deprecations
-
OnChanges
is now officially deprecated. Please useAfterChanges
instead.- If you don't use the
changes
map at all, just remove the parameter and
you're good to go. - If you are only tracking the change of one or two fields, consider using a
boolean, i.e.valueChanged
, which can be set in thevalue
setter and
then checked inngAfterChanges
. - If you are making extensive use of the
changes
map, then consider
recreating the map manually.
- If you don't use the
angular_test
2.3.0
New Features
- Added support for periodic timers in
FakeTimeNgZoneStabilizer
.
angular_forms
2.1.2
- Maintenance release to support Angular 5.3.
angular_router
2.0.0-alpha+22
New features
-
RouteDefinition.defer
now supports an optionalprefetcher
parameter
which can be defined to prefetch additional resources that are dependent on
the matchedRouterState
. -
The
RouteDefinition
subclassesDeferredRouteDefinition
,
RedirectRouteDefinition
, andComponentRouteDefinition
are now exported
frompackage:angular_router/testing.dart
.
Bug fixes
-
Deferred route loaders and prefetchers are no longer called a second time
when matched during route resolution. -
Navigation requests triggered by
popstate
events will now update the
browser location if the resulting navigation matches a redirecting route or
is transformed by aRouterHook
implementation.
angular_compiler
0.4.3
-
FormatExceptions thrown while parsing modules in InjectorReader are now
rethrown as BuildErrors with source information. -
The InjectorReader will fail earlier in the compile process on parse errors.
-
Unhandled errors from InjectorReader are now caught and reported with source
information. -
BuildError now has factory constructors to create errors for annotations and
elements.
angular_ast
0.5.9
- Errors caused by parsing an invalid micro expression (i.e.
*ngFor
) are now
reported to the registeredExceptionHandler
rather than thrown.
5.2.0
angular
5.2.0
Breaking changes
-
The template parser no longer supports styles defined inside the template
itself.Previously, the following two snippets would have been parsed and shimmed in
the same way.<style> .my-class {padding: 10px;} </style>
@Component( styles: ['.other-class {padding: 10px;}'], ) class ExampleComponent{}
Now, only the latter will be parsed and shimmed. The former will be ignored.
-
The template parser no longer supports loading stylesheets defined in an
<link>
tag in the template itself.Previously, the following two snippets would have loaded the exact same
stylesheet.<link href="my-styles.css" rel="stylesheet" />
@Component( styleUrls: ['my-styles.css'], ) class ExampleComponent {}
Now, only the latter will actually be loaded. The former will be ignored.
-
The deprecated field,
ComponentRef.componentType
, which always threw, has
now been completely removed. This was a legacy field for older clients of
AngularDart.
New features
-
Better error messages in the compiler by failing fast on all analyzer errors
in element annotations (@component, etc) and passing the analyzer error
messages to the user. -
Added
runAfterChangesObserved
toNgZone
. This API is intended to be a
more precise way to execute code after AngularDart would have run change
detection (instead of relying onscheduleMicrotask
orTimer.run
). -
Added new type-safe ways to use the
Injector
API without dynamic calls:void example(Injector injector) { // Injecting "SomeType". // Before: var someType1 = injector.get(SomeType) as SomeType; // After: var someType2 = injector.provide<SomeType>(); // Injecting "OpaqueToken<SomeType>(...)". // Before: var someToken1 = injector.get(someToken) as SomeType; // After: var someToken2 = injector.provideToken(someToken); }
-
The code in generated
AppView
no longer performs null safety?.
checks
when calling child views.destroy()
or.destroyNestedViews()
. This means
that misbehaving code could have slightly more confusing stack traces
(new null errors), at the benefit of reduced code-size across the board. -
It's now a build error for
@Component()
to include an entry in
directiveTypes
that types a directive not present indirectives
.
Bug fixes
-
#1653:
AppView.lastRootNode
now correctly returns the last root node
when multipleViewContainer
s are directly nested. -
When using the
@deferred
annotation in a template file, ensure that the
constructed component class uses the deferred import. For example, we now
emitdeflib1.ComponentName(...)
instead oflib1.ComponentName(...)
. This
should ensure Dart2JS properly defer loads the entire component. -
Typing a generic directive with a private type argument is now a build
error. Directive type arguments must be public so that they can be
referenced by the generated library that instantiates the directive.
Previously, this would build successfully but emit code that instantiated
the directive withdynamic
in place of the private type. -
#1665:
@Optional()
dependencies of pipes are now correctly treated as
optional. Previously the annotation was ignored, and attempting to
instantiate the pipe with a missing optional dependency would throw an error
for the missing dependency. -
#1666: Properly emit calls from event bindings in templates where the
tear-off function has one or more named arguments. Previously we would
consider named arguments in the same vane as positional, and it would
generate invalid code causing Dart2JS or DDC to fail compilation. -
The
@deferred
annotation now also defers the annotated component's
defining library, rather than just its generated template's library.
angular_test
2.2.0
Breaking Changes
-
Changed
NgTestStabilizer
initialization from originating from a
List<NgTestStabilizerFactory>
to a singleNgTestStabilizerFactory
. The
new top-level functioncomposeStabilizers
may be used to create a
composite factory from multiple factories:composeStabilizers([ (_) => stabilizer1, (_) => stabilizer2, ])
This helps disambiguate the order of stabilizers running, which in turn will
allow additional new stabilizers and features to be added in a non-breaking
fashion. This change does not impact users that were not augmenting or
creating their own stabilizers (i.e. most users/most tests). -
Removed
NgTestStabilizer.all
. SeecomposeStabilizers
instead. -
Removed
NgZoneStabilizer
. The new class isRealTimeNgZoneStabilizer
,
though most users should not be impactedNgTestBed
now uses the new
stabilizer by default.
New Features
- Added a new
NgTestStabilizer.alwaysStable
, which does what it sounds like
and always reports stability. This handles making composition easier as the
root stabilizer can effectively be a no-op.
Bug Fixes
- When using
RealTimeNgZoneStabilizer
, do not try to stabilize timers that
run outside of Angular zone.
angular_forms
2.1.1
- Maintenance release to support Angular 5.2.
angular_router
2.0.0-alpha+21
- Maintenance release to support Angular 5.2.
angular_compiler
0.4.2
-
Updates the
messages.unresolvedSource
API to support different error
messages for eachSourceSpan
affected. -
Update failure message to include an asset id when collecting type
parameters. -
TypedReader
now throws a build error when reading a private type argument.
angular_ast
0.5.8
- Fixed a type error that occurred when recovering from a missing closing
banana ')]'.
5.1.0
angular
5.1.0
New features
-
Added support for generic components and directives.
Type arguments can now be specified for any generic components and
directives viaTyped
instances passed to theComponent
annotation's
directiveTypes
parameter.@Component( selector: 'generic', template: '{{value}}', ) class GenericComponent<T> { @Input() T value; } @Component( selector: 'example', template: ''' <generic [value]="value"></generic> ''', directives: [ GenericComponent, ], directiveTypes: [ Typed<GenericComponent<String>>(), ], ) class ExampleComponent { var value = 'Hello generics!'; }
The
Typed
class also has support for typing specific component and
directive instances by#
-reference, and flowing generic type parameters
from the annotated component as type arguments to its children. See its
documentation for details. -
#930: Added
@visibleForTemplate
topackage:angular/meta.dart
. This
is an optional annotation that may be used to annotate elements that
should only be used from within generated code (i.e. a.template.dart
).
It is a compile-time hint, which may be treated as a failing build, to use
annotated elements outside of the component or template.This annotation is intended to give component authors more control in
specifying the public API of their component(s), especially coupled with the
fact that AngularDart requires all members to be public to be reachable from
generated code. For example,c
andngAfterChanges
are only accessible
fromCalculatorComponent
(or its template) in the following:import 'package:angular/angular.dart'; import 'package:angular/meta.dart'; @Component( selector: 'calculator-comp', template: '{{a}} + {{b}} = {{c}}', ) class CalculatorComponent implements AfterChanges { @Input() num a = 0; @Input() num b = 0; @visibleForTemplate num c = 0; @override @visibleForTemplate void ngAfterChanges() { c = a + b; } }
NOTE: This feature is only enforced in SDK:
>=2.1.0-dev.3.1
. -
Added support for internationalization in templates.
The
@i18n
annotation marks content in document fragments or attributes for
internationalization via integration withpackage:intl
.A document fragment can be internationalized by applying the
@i18n
annotation to its parent element:<div @i18n="A description of the message."> A message to be <i>translated</i>! </div>
An attribute, property, or input
<name>
can be internationalized by
applying the@i18n:<name>
annotation to its host element:<input placeholder="A message to be translated" @i18n:placeholder="A description of the message.">
Note that internationalization in templates currently only supports messages
with static text and HTML. See the example for more details.
Bug fixes
-
#1538: A compile-time error is reported if the
@deferred
template
annotation is present on a<template>
element or is a sibling to a
structural directive (such as*ngIf
). Before we would silently drop/ignore
the annotation, so this might be considered a breaking change of an
incorrect program. The fix is just to move the annotation, such as:<!-- Before (Both are identical) --> <template @deferred [ngIf]="showArea"> <expensive-comp></expensive-comp> </template> <expensive-comp *ngIf="showArea" @deferred></expensive-comp> <!-- After (Both are identical) --> <template [ngIf]="showArea"> <expensive-comp @deferred></expensive-comp> </template> <ng-container *ngIf="showArea"> <expensive-comp @deferred></expensive-comp> </ng-container>
-
#1558: When importing a
library.dart
that has two or more components
(i.e.Comp1
andComp2
), and at least one component is used@deferred
and at least one component is used without@deferred
, the compiler would
generate invalid Dart code that would fail analysis/compilation to JS.
Correct code is now emitted, allowing the described scenario to work. -
#1539: Fixed a bug where components that were
@deferred
as the direct
child of another<template>
tag had phantom DOM left behind even after the
parent template was destroyed. For example:<template [ngIf]="showComponent"> <expensive-comp @deferred></expensive-comp> </template>
... additionally, a check for a race condition of the deferred component
being loaded after the parent view was already destroyed was added. As
a result, #1540 has also been fixed (view and content queries were not
getting reset as the@deferred
node was destroyed). -
#880: Fixed a bug where an extraneous space in
*ngFor
micro expression
caused the directive to no longer be functional
(*ngFor="let x; let i = $index "
, for example). -
#1570: When a provider's
token
for@GeneratedInjector(...)
is read
asnull
(either intentionally, or due to analysis errors/imports missing)
a better error message is now thrown with the context of the error. -
#434: In development mode, creating a component or service
C
that
attempts to inject a missing dynamic dependencyD
will now throw an error
message containingCould not find provider for D: C -> D
. Previously the
message was onlyCould not find provider for D
in these cases, which was
often not enough information to debug easily. -
#1502: When parsing an invalid template micro expression (i.e.
*ngFor="let item of items;"
- note the trailing;
), throws a proper
unexpected token error instead of a confusing type error during recovery. -
#1500: Configuring a provider with
FactoryProvider(Foo, null)
is now
a compile-time error, instead of a misleading runtime error. -
#1591: Using
@GenerateInjector
with aValueProvider
bound to a
String
instance that expects a raw string (i.er'$5.00'
) no longer
generates invalid code. Now all strings are emitted as raw. -
#1598: Using
@GenerateInjector
with aValueProvider
whose value
is created as aconst
object with named arguments is now created
correctly. Before, all named arguments were skipped (left to default values,
which was oftennull
). -
@GenerateInjector(...)
now correctly solves duplicate tokens by having
the last, not first, provider win. This aligns the semantics with how
the other injector implementations work. ForMultiToken
, the order stays
the same. -
Clarified that
Injector.map({...})
doesn't supportnull
as values. -
Named arguments are now supported for function calls in templates where the
function is an exported symbol (Component(exports: [someFunction])
). -
#1625: Named arguments in function calls in templates that collide with
an exported symbol (Component(exports: [someExport])
) no longer cause a
parsing error. -
Whitespace in internationalized message descriptions and meanings is now
normalized so they're no longer affected by formatting changes. Identical
messages with meanings that are formatted differently will now properly be
treated as the same message. -
#1633: Using a function type or any non-class
Type
inside of the
@GenerateInjector([...])
annotation would cause a non-ideal error to be
produced. It now includes more information where available.
Other improvements
-
Error messages for misconfigured pipes now display their source location.
-
Assertion added for ensuring different SanitizationServices aren't used when
calling runApp multiple times. SanitizationService is a static resource so
different instances would not work as expected. -
AppViewUtils.resetChangeDetection()
is now deprecated and will be removed
in the next major release.
angular_forms
2.1.0
New Features
PatternValidator
now has apattern
input. This allows thepattern
property to be set dynamically. Previously, this could only be specified
statically at compile time.
angular_test
2.1.0
New Features
-
Supported
beforeComponentCreated(Injector)
when creating fixture to allow
usinginjector
to set up prerequisite data for testing from DI.This is useful when an object (that is already injected to the ...
5.0.0
angular
5.0.0
Welcome to AngularDart v5.0.0, with full support for Dart 2. Please note that
this release is not compatible with older versions of Dart 1.XX. Additionally:
- Dartium is no longer supported. Instead, use the new
DartDevCompiler - Pub transformers are no longer used. Instead, use the new
webdev CLI, or, for advanced
users, the build_runner
CLI.
More details of
changes to Dart 2 for web users are
available on our webiste.
Thanks, and enjoy AngularDart!
Dependency Injection
Dependency injection was enhanced greatly for 5.0.0, primarily around using
proper types (for Dart 2), and paths to enable much smaller code size (for
everyone).
New features
-
Provider
(andprovide
) are soft deprecated, and in their place are
four new classes with more precise type signatures. Additionally,Provider
now supports an optional type argument<T>
, making itProvider<T>
.-
ValueProvider(Type, T)
andValueProvider.forToken(OpaqueToken<T>, T)
instead ofProvider(typeOrToken, useValue: ...)
. -
FactoryProvider(Type, T)
andFactoryProvider.forToken(OpaqueToken<T>, T)
instead ofProvider(typeOrToken, useFactory: ...)
. -
ClassProvider(Type, useClass: T)
and
ClassProvider.forToken(OpaqueToken<T>, useClass: T)
instead of
Provider(typeOrToken, useClass: ...)
or an implicitType
. -
ExistingProvider(Type, T)
and
ExistingProvider.forToken(OpaqueToken<T>, T)
instead of
Provider(typeOrToken, useExisting: ...)
.
-
-
OpaqueToken
is now much more useful. Previously, it could be used to
define a custom, non-Type
to refer to something to be injected; commonly
instead of types likeString
. For example, you might use anOpaqueToken
to refer to the a URL to download a file from:const downloadUrl = OpaqueToken('downloadUrl'); @Component( providers: [ Provider(downloadUrl, useValue: 'https://a-site.com/file.zip'), ], ) class Example { Example(@Inject(downloadUrl) String url) { // url == 'https://a-site.com/file.zip' } }
First,
OpaqueToken
adds an optional type argument, making
OpaqueToken<T>
. The type argument,T
, should be used to refer to the
Type
of the object this token should be bound to:const downloadUrl = OpaqueToken<String>('downloadUrl');
Coupled with the new named
Provider
classes and their.forToken
named
constructor (see below), you now also have a way to specify the type of
providers using type inference:@Component( providers: [ // This is now a Provider<String>. ValueProvider.forToken(downloadUrl, 'https://a-site.com/file.zip'), ], )
Second,
MultiToken<T>
has been added, and it extends
OpaqueToken<List<T>>
. This is an idiomatic replacement for the now
deprecatedmulti: true
argument to theProvider
constructor:const usPresidents = MultiToken<String>('usPresidents'); @Component( providers: [ ValueProvider.forToken(usPresidents, 'George'), ValueProvider.forToken(usPresidents, 'Abe'), ], ) class Example { Example(@Inject(usPresidents) List<String> names) { // names == ['George', 'Abe'] } }
Third, we heard feedback that the
String
-based name of tokens was
insufficient for larger teams because the names could collide. Imagine 2
different tokens being registered with a name of'importantThing'
! It is
now possible (but optional) toextend
eitherOpaqueToken
orMultiToken
to create scoped custom token names:class DownloadUrl extends OpaqueToken<String> { const DownloadUrl(); } class UsPresidents extends MultiToken<String> { const UsPresidents(); } class Example { providers: const [ ValueProvider.forToken(DownloadUrl(), 'https://a-site.com/file.zip'), ValueProvider.forToken(UsPresidents(), 'George'), ValueProvider.forToken(UsPresidents(), 'Abe'), ], }
Fourth, and finally, we'd like to repurpose
@Inject
in the future, and let
you write less to inject tokens. So,OpaqueToken
andMultiToken
instances may now be used directly as annotations:class Example { Example(@DownloadUrl() String url, @UsPresidents() List<String> names) { // url == 'https://a-site.com/file.zip' // names == ['George', 'Abe'] } }
-
InjectorFactory
, a function type definition ofInjector Function([Injector parent])
, was added and started to be used across the
framework. It normally indicates the ability to create a newInjector
instance with an optional parent. -
A new annotation,
@GenerateInjector
, was added. It is now posibble to
generate, at compile-time, a standaloneInjectorFactory
method for
providers, without explicitly wrapping in an@Component
:// example.dart import 'example.template.dart' as ng; @GenerateInjector([ ClassProvider(HelloService), ]) final InjectorFactory rootInjector = ng.rootInjector$Injector;
-
Module
has been added as a new, more-typed way to encapsulate a collection
ofProvider
instances. This is an optional feature to use instead of
nestedconst
lists to represent shared providers. For example:const httpModule = [ /* Other providers and/or modules. */ ]; const commonModule = [ httpModule, ClassProvider(AuthService, useClass: OAuthService), FactoryProvider.forToken(xsrfToken, useFactory: readXsrfToken), ];
... you can represent this with the new typed
Module
syntax:const httpModule = Module( /* ... Configuration ... */); const commonModule = Module( include: [httpModule], provide: [ ClassProvider(AuthService, useClass: OAuthService), FactoryProvider.forToken(xsrfToken, useFactory: readXsrfToken), ], );
The advantages here are numerous:
-
Less ambiguity around ordering of providers. Engineers would tend to try
and sort providers alphabetically, would of course, would lead to
problems.Module
specifically outlines that order is significant,
and thatinclude
is processed beforeprovide
. -
Module
rejects using aType
implicitly as aClassProvider
. This
removes additional ambiguity around supportingList<dynamic>
, and
while more verbose, should lead to more correct use. -
Module
tends to be more understandable by users of other dependency
injection systems such as Guice or Dagger, and reads better than a
const
List
(which is a very Dart-only idiom).
NOTE: It is also possible to use
Module
in@GenerateInjector
:@GenerateInjector.fromModules([ commonModule, ]) final InjectorFactory exampleFromModule = ng.exampleFromModule$Injector;
NOTE: It is also possible to use
Module
inReflectiveInjector
:// Using ReflectiveInjector is strongly not recommended for new code // due to adverse effects on code-size and runtime performance. final injector = ReflectiveInjector.resolveAndCreate([ commonModule, ]);
-
Breaking changes
-
OpaqueToken
no longer overridesoperator==
orhashCode
. In practice
this should have no effect for most programs, but it does mean that
effectively that onlyconst
instances ofOpaqueToken
(orMultiToken
)
are valid. -
It is no longer valid to provide a token type of anything other than
Type
or anOpaqueToken
(orMultiToken
). In the past anything from aribtrary
literals (such as a string -'iAmAToken'
) or a customconst
instance of
a class were supported. -
For defining whether a component or directive should provide itself for
injection,Visibility.none
has been renamedVisibility.local
to make it
more clear that it is accessable locally (withinproviders
for example). -
Classes annotated with
@Component
or@Directive
are no longer treated
like services annotated with@Injectable
, and not accessible (by default)
toReflectiveInjector
.@Injectable
can always be added to these classes
in order to return to the old behavior.
Bug fixes
-
Fixed a bug where calling
get
on anInjector
injected in the context of
an@Component
or@Directive
-annotated class and passing a second
argument always returnednull
(instead of that second argument) if the
token was not found. -
Setting
@Component(visibility: Visibility.none
) no longer applies to
providers
, if any. Note thatVisibility.none
was always renamed
Visibility.local
in breaking changes above. -
Fixed a bug where
Provider(SomeType)
was not parsed correctly as an
implicit use ofProvider(SomeType, useClass: SomeType
). -
Fixed a bug where
<ReflectiveInjector>.get(X)
would throw with a message
of no provider found for X, even when the acutal cause was a missing
downstream dependencyY
. We now emit the correct message.
Other improvements
- Some injection failures will display the chain of dependencies that were
...
5.0.0-beta+3
angular
5.0.0-beta+3
Other improvements
- Removed dependency on
package:tuple
.
angular_router
2.0.0-alpha+18
Bug fixes
HashLocationStrategy
no longer drops query parameters (before the #) when
pushing or replacing an empty URL.
angular_forms
2.0.0-beta+3
- Maintenance release to bring into sync with
angular 5.0.0-beta+3
.
angular_test
2.0.0-beta+3
-
Deleted an unnecessary
hostElement.append(componentRef.location)
. -
Supported
FutureOr<void>
forbeforeChangeDetection
.
angular_compiler
0.4.0-alpha+19
- Added
TypedElement
to represent a statically parsedTyped
. TypedReader.parse()
now returns aTypedElement
.
angular_ast
0.5.5
- Maintenance release for
-dev.68
.
5.0.0-beta+2
We accidentally missed 5.0.0-beta+1
, but it was available on pub.
angular
5.0.0-beta+2
New features
-
Added support for named arguments in function calls in templates:
<span>Hello {{getName(includeExclamationPoint: true)}}</span>
NOTE: Because of the collision of syntax for both named arguments and
pipes, any pipes used as the value of a named argument need to be wrapped
in parentheses: func(namedArg: (pipeName | pipeVar:pipeVarValue))
.
Bug fixes
-
Changed the behavior of warnings around
@ViewChildren(...)
. It was more
difficult than originally thought to warn on incorrect selector usage due to
the semantics of components and dependency injection. In many cases false
positives were flagged. Now, any unknown type is just ignored (it may still
be invalid), and any invalid value throws a build error. For example:class A { // Might not be valid, but we no longer warn. @ViewChildren(SomeArbitraryType) List<SomeArbitraryType> someTypes; // We throw a build error. @ViewChildren(1234) List thisDoesNotWork; }
-
Implicit static tear-offs and field invocations are now supported:
@Component( selector: 'example', template: ''' <!-- Invoking an implicit static field. --> <div>{{field()}}</div> <!-- Binding an implicit static tear-off. --> <div [invoke]="tearOff"></div> ''', ) class ExampleComponent { static String Function() field = () => 'Hello world'; static String tearOff() => 'Hello world'; }
5.0.0-beta+1
New features
-
A warning is produced if the compiler removes any elements
(such as<script>
) from your template. This may become an error in future
versions of AngularDart. Closes #1280. -
A warning is produced if the selector provided to a query (such as
@ViewChildren(...)
) is invalid and will not produce any elements at
runtime. This may become an error in future versions of AngularDart.
Closes #1220. -
It is now possible to annotate parts of a template with
@preserveWhitespace
instead of opting into preserving whitespace for the
entire template. Closes #1295:<div> <div class="whitespace-sensitive" @preserveWhitespace> Hello World! </div> </div>
-
Added
package:angular/meta.dart
, a series of utilities for additional
static analysis checks and/or functions to retain semantics for migration
purposes, starting withcastCallback1ForDirective
and
castCallback2ForDirective
. These methods are only intended to be used
as stop-gaps for the lack of generic support in AngularDart directives and
components. Closes #1489.
Bug fixes
-
Fails the build immediately if an element in a component's
pipes
list is
unresolved. -
Support inherited method tear-offs in event listeners. Previously, we only
considered methods in the Component class itself. Closes #506. -
Fixed a bug where
[attr.name.if]
did not work on a static@HostBinding
.
Closes #1484.
Other improvements
-
Fixed a bug where many queries (
@ViewChildren()
and the like) generated
additional runtime casts in production mode. Now in Dart2JS with
--omit-implicit-checks
the casts are removed. -
Emits more optimized code when there are multiple data bindings in a row
that are checked only once (such asfinal
strings). Previously we
generated redundant code. -
Fixed an optimization issue when
@ViewChild()
or@ContentChild()
was
used on a nested element (i.e. inside a<template>
). The code that was
produced accidentally created two queries instead of one.
Closes #1455.
angular_ast
0.5.4
- Add
CloseElementAst
complement intoContainerAst
. - Added support for annotations on
<template>
. - The whitespace transformer now understands
@preserveWhitespace
.
angular_compiler
0.4.0-alpha+18
- Added
$Typed
, aTypeChecker
forTyped
. - Added
TypeReader
for parsing generic directive types.
0.4.0-alpha+17
- Maintenance release.
- The minimum SDK version is now
sdk: ">=2.0.0-dev.64.2 <2.0.0"
.
angular_forms
2.0.0-beta+2
New Features
- Add AbstractControlGroup and AbstractNgForm to allow infrastructure to
create their own form systems that can be backed by types such as a proto,
or have different control group logic.
Breaking Changes
- Use value from AbstractControl for valueChanges event instead of internal
variable. Allows code to more easily subclass AbstractControl.
2.0.0-beta+1
- Maintenance release; declare official support for the Dart2 SDK.
angular_router
2.0.0-alpha+17
New features
RouteDefinition.redirect
now supports forwarding route parameters.
2.0.0-alpha+16
- Maintenance release; declare official support for the Dart2 SDK.
angular_test
2.0.0-beta+2
- Maintenence release: Stop using
SCREAMING_CAPS
consts fromdart:*
.
2.0.0-beta+1
- Maintenance release; declare official support for the Dart2 SDK.