Releases: angulardart/angular
5.0.0-alpha+6
angular
5.0.0-alpha+6
New features
-
The compiler now reports an actionable error when an annotation is used on a
private class member. -
Added
InjectionErrorandNoProviderError, which may be thrown during
dependency injection whenInjectionError.enableBetterErrorsis set to
true. This is an experiment, and we may not complete this feature (and it
could be rolled back entirely). -
Added
@GenerateInjector, a way to generate a factory for anInjector
completely at compile-time, similar to@Componentor@Directive. This
replaces the experimental feature@Injector.generate, and can be used in
conjunction with theInjectorFactoryfunction type:
import 'my_file.template.dart' as ng;
@GenerateInjector(const [
const Provider(A, useClass: APrime),
])
// The generated factory is your method's name, suffixed with `$Injector`.
final InjectorFactory example = example$Injector;- You are now able to use an
OpaqueTokenorMultiTokenas an annotation
directly instead of wrapping it in@Inject. For example, the following
classes are identically understood by AngularDart:
const baseUrl = const OpaqueToken<String>('baseUrl');
class Comp1 {
Comp1(@Inject(baseUrl) String url);
}
class Comp2 {
Comp2(@baseUrl String url);
}- You are now able to
extendOpaqueTokenorMulitTokento provide
custom application-specific injection tokens. For example, providing a
specific token for XSRF purposes:
class XsrfToken extends OpaqueToken<String> {
const XsrfToken();
}
@Component(
providers: const [
const ValueProvider.forToken(const XsrfToken(), 'ABC123'),
],
)
class Comp {
Comp(@XsrfToken() String token) {
print(token); // ABC123
}
}Breaking changes
-
Restricted the default visibility of all components and directives to
Visibility.local. This means components and directives will no longer be
available for injection by their descendants, unless their visibility is
explicitly set toVisibility.all. This feature had a cost in code size but
was rarely used, so it's now opt-in, rather than the default behavior. -
We now use a different code-path for the majority of content and view
queries, with the exception of places statically typedQueryList. While
this is not intended to be a breaking change it could have timing
implications. -
Both
COMMON_DIRECTIVESandCORE_DIRECTIVESare now deprecated, and
should be replaced bycoreDirectives. This is a no-op change (alias). -
Removed the deprecated
EventEmitterclass from the public entrypoints.
Bug fixes
-
An invalid event binding (
<comp (event-with-no-expression)>) no longer
crashes the parser during compilation and instead reports that such a
binding is not allowed. -
Corrects the behavior of
Visibility.localto match documentation.Previously, a directive with
Visibility.localwas only injectable via an
alias within its defining view. This meant the following was possibleabstract class Dependency {} @Component( selector: 'dependency', template: '<ng-content></ng-content>', providers: const [ const Provider(Dependency, useExisting: DependencyImpl), ], visibility: Visibility.local, ) class DependencyImpl implements Dependency {} @Component( selector: 'dependent', ... ) class Dependent { Dependent(Dependency _); // Injection succeeds. } @Component( selector: 'app', template: ''' <dependency> <dependent></dependent> </dependency> ''', directives: const [Dependency, Dependent], ) class AppComponent {}
because both
DependencyImplandDependentare constructed in the same
method, thus the instance ofDependencyImplcould be passed directly to
Dependentwithout an injector lookup. However, the following failed@Component( selector: 'dependency', // `Dependent` will fail to inject `Dependency`. template: '<dependent></dependent>', directives: const [Dependent], providers: const [ const Provider(Dependency, useExisting: DependencyImpl), ], visibility: Visibility.local, ) class DependencyImpl implements Dependency {}
because no code was generated for children to inject
Dependency. This was
at odds with the documentation, and optimized for a very specific use case.This has been fixed and it's now possible for all children of
DependencyImplto injectDependency, not just those constructed in the
same view. -
Services that were not marked
@Injectable()are no longer skipped when
provided inproviders: const [ ... ]for a@Directiveor@Component.
This choice made sense when@Injectable()was required, but this is no
longer the case. Additionally, the warning that was printed to console has
been removed. -
It is no longer a build warning to have an injectable service with multiple
constructors. This was originally meant to keep injection from being too
ambiguous, but there are understood patterns now (first constructor), and
there is no alternative present yet. We may re-add this as a warning if
there ends up being a mechanism to pick a constructor in the future. -
It is no longer a build warning to have injectable services or components
with named constructor parameters. While they are still not supported for
injected, they were always successfully ignored in the past, and showing a
warning to the user on every build served no purpose. -
If a
templateUrlis mispelled, a more readable exception is thrown (closes
#389):[SEVERE]: Unable to read file: "package:.../not_a_template.html" Ensure the file exists on disk and is available to the compiler.
-
If both
templateANDtemplateUrlare supplied, it is now a cleaner build
error (closes #451):[SEVERE]: Component "CompWithBothProperties" in asset:experimental.users.matanl.examples.angular.template_url_crash/lib/template_url_crash.dart: Cannot supply both "template" and "templateUrl"
-
If neither is supplied, it is also a cleaner build error:
[SEVERE]: Component "CompWithNoTemplate" in asset:experimental.users.matanl.examples.angular.template_url_crash/lib/template_url_crash.dart: Requires either a "template" or "templateUrl"; had neither.
-
If a
templateis a string that points to a file on disk, we now warn:[WARNING]: Component "CompMeantTemplateUrl" in asset:experimental.users.matanl.examples.angular.template_url_crash/lib/template_url_crash.dart: Has a "template" property set to a string that is a file. This is a common mistake, did you mean "templateUrl" instead?
-
If a private class is annotated with
@Injectable()the compiler fails. In
practice this caused a compilation error later in DDC/Dart2JS, but now the
AngularDart compiler will not emit invalid code. -
Removed spurious/incorrect warnings about classes that are used as
interfaces needing@Injectable(or needing to be non-abstract), which
are wrong and confusing. -
Fixed a case where the compiler generated incorrect code when a directive D
was applied to the host element of component C where- C implements D,
- C provides D as an alias for itself, and
- C has
Visibility.local.
Normally the local reference for C would be reused instead of creating a new
D. Giving C local visibility incorrectly prevented this assignment and
generated code to inject D from the parent injector. -
Fixed a bug where
Provider<List<T>>was treated asProvider<List>when
compiled as part of the view compiler (@Component.providers:). Now the
additional generic types flow through the compiler. -
Fixed a case where provider fields weren't type annotated. In some cases
this led to DDC warnings that are to become errors. -
The code generated for injecting a multi-token will now correctly inject a
provider that uses an existing directive withVisibility.local. This
previously failed if another existing directive withVisibility.allwas
provided for the same multi-token, after the one withVisibility.local.
angular_router
2.0.0-alpha+6
New features
Router.onNavigationStartnow emits the requested navigation path.
angular_forms
1.0.1-alpha+6
New features
- Add
markAsUntouchedmethod toAbstractControl. - Add a type annotation,
T, toAbstractControl, which is tied to the type
ofvalue. ControlGroupnowextends AbstractControl<Map<String, dynamic>>.ControlArraynowextends AbstractControl<List>.
Breaking Changes
- Changed type of
AbstractControl.statusChangesfromStream<dynamic>to
Stream<String>. This now matches the type forAbstractControl.status,
which as always been aString.
Deprecations
FormBuilderinstance methodsgroup,control, andarrayare now
deprecated. ForFormBuilder.control, just callnew Control(value, validator)directly. ForFormBuilder.groupandFormBuilder.array, use
the static methodsFormBuilder.controlGroupandFormBuilder.controlArray
respectively. In a future release,FormBuilderwill not not be
`Injectab...
5.0.0-alpha+5
angular
5.0.0-alpha+5
New features
-
Enables the new template parser by default. This parser is much stricter than
the old one, as it will detect things like missing closing tags or quotation
marks.If you need to turn it off temporarily, you need to set the following flag in
yourbuild.yaml:
targets:
$default:
builders:
angular:
options:
use_new_template_parser: false-
Requires
source_gen ^0.7.4+2(was previously^0.7.0). -
The compiler behind
initReflector()has changed implementations and now
uses fully-scoped import statements instead of trying to figure out the
original scope (including import prefixes) of your source code. This is not
intended to be a breaking change.
Breaking changes
- We have removed the transformer completely from
angular. It is now a
requirement that you usebuild_runnerto buildangular.
For more details, see Building Angular.
-
QueryListis now formally deprecated. Seedoc/deprecated_query_list.md.
This feature is not compatible with future restrictions of Dart 2, because
QueryListwas always created as aQueryList<dynamic>, even though users
expected it to be aQueryList<T>. The new API is fully compatible. -
SlowCompinentLoaderis now formally deprecated. See
doc/component_loading.md. This feature is not compatible with future
restrictions of AngularDart, because it requires collecting metadata and
disabling tree-shaking of classes annotated with@Component. The newer API
is nearly fully compatible, is faster, and will be supported long-term. -
Explicitly remove support for
ngNonBindablein the new template parser. -
Both
@Component.hostand@Directive.hostwere deprecated several versions
back, but not properly, so warnings never appeared in IDEs. They are now
properly deprecated:
'Use @HostBinding() on a getter or @HostListener on a method'. -
ElementRefis now deprecated. InjectElementorHtmlElementinstead.
This has unnecessary overhead on-top of the native DOM bindings without any
benefit.
Bug fixes
-
The experimental feature
@Injector.generatenow supports someconst
expressions in a Provider'suseValue: .... There are remaining known
issues with this implementation, anduseFactoryshould be used instead if
you encounter issues. -
Fixed a bug where a
Injector.getcall whereInjectoris a
ReflectiveInjector(which is also the injector most commonly used for both
the entrypoint and virtually every test) would throw
No provider found for X, whereXwas a class or factory that was found
but one or more ofX's dependencies were not found. We now correctly throw
No provider found for Y(whereYwas that actual missing dependency). -
OpaqueToken<T>was emitted asOpaqueToken<dynamic>when you used nested
views (<div *ngIf="..."><comp></comp></div>), and<comp>was a component
or directive that@Inject-ed a typed token (likeOpaqueToken<String>);
this is now fixed. -
Trying to use
@{Content|View}Child{ren}withElementorHtmlElement
(fromdart:html) caused a runtime exception, asElementRefwas passed
instead. The following now works:
@Component(
selector: 'uses-element',
template: '<div #div>1</div>'
)
class UsesElement {
@ViewChild('div')
// Could also be HtmlElement.
Element div;angular_ast
0.4.3
- Maintenance release, supporting newer package versions.
angular_compiler
0.4.0-alpha+5
Bug fixes
linkTypeOfcorrectly resolves bound types (i.e.<T>) in most cases, and
can fallback todynamicotherwise.
Breaking changes
-
Requires
source_gen ^0.7.4+2(was previously^0.7.0). -
linkToReferencenow requires a second parameter, aLibraryReader, and
treats private types (i.e. prefixed with_) asdynamicas the compiler
cannot point to them. -
ReflectableEmitterhas been completely replaced with a new implementation. -
Removed all references and use of determining a "prefix" of a type. This was
no longer used onceReflectableEmitterwas re-written. -
Removed a number of internal flags that were no longer strictly required.
angular_forms
1.0.1-alpha+5
Maintenance release, to support the latest package:angular alpha.
angular_router
2.0.0-alpha+5
New features
-
Added
Router.onNavigationStartto notify subscribers when a navigation
request starts. -
Added the
routerProvidersTestmodule for testing route configurations or
components with router dependencies.
Breaking changes
- Removed fuzzy arrow from
MockLocationStrategy. It relied on Dart 1's
treatment of dynamic as bottom to mock handling ofpopstateevents without
actually relying ondart:html. Since Angular must be tested in the browser
anyways, there's no incentive to avoid this dependency. As a consequence,
the signature ofMockLocationStrategy.onPopStateis now unchanged from
LocationStrategy.onPopState.
angular_test
2.0.0-alpha+3
- Removed support for
pub run angular_test. This is no longer strictly
needed, as it was just a convenience for running both the build system and
test runner. Similar functionality is supported out of the box by
build_runner:
$ pub run build_runner test5.0.0-alpha+4
angular
5.0.0-alpha+4
-
We have a new template parser. This parser is much stricter than the old one,
as it will detect things like missing closing tags or quotation marks.
Enabling it will be a major breaking change, so we encourage you to try it out
in this alpha release before we enable it by default in the next one.In order to use it, you need to set the following flag in your
build.yaml:
builders:
angular:
options:
use_new_template_parser: True- We now require
code_builder ^3.0.0.
New features
- Using
OpaqueToken<T>andMutliToken<T>whereTis notdynamicis
now properly supported in all the different implementations of Injector. As
a consequence relying on the following is now a breaking change:
// These used to be considered the same in some DI implementations.
const tokenA = const OpaqueToken<String>('a');
const tokenB = const OpaqueToken<dynamic('b');- Added a lifecycle event
AfterChanges, which is similar toOnChanges, but
with a much lower performance cost - it does not take any parameters and is
suitable when you have multiple fields and you want to be notified when any
of them change:
class Comp implements AfterChanges {
@Input()
String field1;
@Input()
String field2;
@override
void ngAfterChanges() {
print('Field1: $field1, Field2: $field2');
}
}Breaking changes
ComponentRef.componentTypethrows anUnsupportedError, pending removal.
This removes our last invocation of.runtimeType, which has potentially
severe code-size implications for some apps.- The type of
EmbeddedViewRef.rootNodesandViewRefImpl.rootNodeshas
changed fromList<dynamic>toList<Node>.
Bug fixes
- Fixed a bug where
Provider(T)was not correctly parsed as an implicit use
ofProvider(T, useClass: T).
angular_router
2.0.0-alpha+4
Breaking changes
- Removed
SpyLocation.MockLocationStrategyshould be used instead.
Bug fixes
-
Prevented
canDeactivate()from being invoked twice during redirection. It
will now only be invoked with the redirected next router state, without also
being invoked with the intermediate next router state. -
Prevented
canNavigate()from being invoked twice during redirection.
angular_forms
1.0.1-alpha+4
Maintenance release, to support the latest package:angular alpha.
angular_test
2.0.0-alpha+2
Maintenance release, to support the latest package:angular alpha.
angular_compiler
0.4.0-alpha+4
Breaking changes
-
ModuleReader.deduplicateProvidersnow returns aListnot aSet, and
providers that are multi are not removed, as it is a feature of the DI
system to have multiple of them with the same token. -
Add the
TypeLinkclass, and replace uses ofUri. -
Require
code_builder ^3.0.0.
New features
-
Added
typeArgumentOfhelper method. -
Added
ReflectableEmitter.useCodeBuilder, which usespackage:code_builder
instead of an ad-hoc string-based output for Dart code. Once this passes the
same suite of tests the original strategy will be removed.
Bug fixes
-
Prevented a
RangeErrorthat occurred when an invalid import lacked an
extension. -
ReflectorEmitternow supportsMultiTokenand generic-typed tokens, with
some known limitations. See #782.
angular_ast
0.4.2
- Supports the latest version of
quiver.
5.0.0-alpha+3
angular
5.0.0-alpha+3
New features
-
Provideris now soft-deprecated (not preferred), and new more-typed
classes exist:ClassProvider,ExistingProvider,FactoryProvider, and
ValueProvider. Each also has a.forTokennamed constructor that infers
theProvider<T>'sTvalue from the providedOpaqueToken<T>'sT.
This is meant to help with the move to strong mode and DDC, and is now the
preferred way to configure dependency injection. -
Any variation of
multi: truewhen configuring dependency injection is now
soft-deprecated (not preferred), and theMultiTokenclass has been added.
AMultiToken<T>now represents anOpaqueToken<T>wheremulti: trueis
implicitly alwaystrue:
const usPresidents = const MultiToken<String>('usPresidents');
@Component(
selector: 'presidents-list',
providers: const [
const ValueProvider.forToken(usPresidents, 'George Washington'),
const ValueProvider.forToken(usPresidents, 'Abraham Lincoln'),
],
)
class PresidentsListComponent {
// Will be ['George Washington', 'Abraham Lincoln'].
final List<String> items;
PresidentsListComponent(@Inject(usPresidents) this.items);
}- We are starting to support the new build system at
dart-lang/build. More
information and documentation will be included in a future release, but we
expect to drop support forpub serve/buildby 5.0.0 final.
Breaking changes
- Dartium is no longer supported. All development of your AngularDart
applications is now required to be in DDC. With incoming language
and library changes this would have been required regardless, but we expect
to have faster build tools available (instead ofpub serve) soon.
Bug fixes
-
Fixed a bug where
ReflectiveInjectorwould return anObjectinstead of
throwingArgumentErrorwhen resolving an@Injectable()service that
injected a dependency with one or more annotations (i.e.@Inject(...)). -
Fixed a bug where
DatePipedidn't formatmillisecondsSinceEpochin the
local time zone (consistent with how it formatsDateTime).
angular_router
2.0.0-alpha+3
New features
-
Added the
CanNavigatelifecycle interface. This is similar to
CanDeactivate, and preferred when the nextRouterStateisn't necessary
to determine whether the router may navigate. -
Added
reloadfield toNavigationParamswhich can be used to force
navigation, even if the path and other navigation parameters are unchanged. -
Added
replacefield toNavigationParamswhich can be used to replace the
current history entry on navigation instead of creating a new one.
Breaking changes
- Removed
hashCodeandoperator ==overrides fromRouteDefinitionand
RouterState, as these can't be removed by tree-shaking.
Bug fixes
- Upon destruction,
RouterOutletwill now properly destroy all of its cached
components, instead of only destroying the active one.
angular_forms
1.0.1-alpha+3
- Some documentation updates.
- Dartium is no longer supported.
angular_test
2.0.0-alpha+1
- Added support for
build.yaml.
angular_compiler
0.4.0-alpha+3
- Added support for recognizing the
MultiTokentype.
angular_ast
0.4.1
Bug fixes
- Un-escape HTML characters, such as
<,∑, or∑, when they
appear in text. Note, we do not do any un-escaping when these characters
appear inside elements.
5.0.0-alpha+2
angular
5.0.0-alpha+2
Breaking changes
-
Replaced
Visibility.nonewithVisibility.local. The former name is
misleading, as a directive is always capable of providing itself locally for
injection via another token. -
RenderComponentTypeis no longer part of the public API. -
Dropped support for
@AngularEntrypointand rewriting entrypoints to
automatically useinitReflector()andbootstrapStatic. This will no
longer be supported in the new build system so we're encouraging that manual
changes are made as of this release:
// test/a_test.dart
import 'a_test.template.dart' as ng;
void main() {
ng.initReflector();
}// web/a_app.dart
import 'package:angular/angular.dart';
import 'a_app.template.dart' as ng;
@Component(selector: 'app', template: '')
class AppComponent {}
void main() {
bootstrapStatic(AppComponent, [/*providers*/], ng.initReflector);
}- Use of the template annotation
@deferreddoes not work out of the box
with the standard bootstrap process (bootstrap/bootstrapStatic), only
the experimentalbootstrapFactory. We've added a backwards compatible
compiler flag,fast_boot, that may be changed tofalse. We don't
expect this to impact most users.
transformers:
angular:
fast_boot: falseBug fixes
-
Fixed a bug where errors thrown in event listeners were sometimes uncaught
by the framework and never forwarded to theExceptionHandler. Closes
#721. -
The
$implicit(iterable) value in*ngForis now properly typed whenever
possible. It was previously always typed asdynamic, which caused dynamic
lookups/calls at runtime, and hid compilation errors. -
Fixed a bug where an
@deferredcomponents were still being linked to in
initReflector().
angular_test
2.0.0-alpha
NOTE: This was previously
1.0.2-alpha+1, but since this has major
breaking changes that make it incompatible with the1.x.xreleases in order
to supportangular 5.x.x, this will now be the2.0.0alpha release.
- Add support for the use of an externally launched
pub serveby
using "none" as the value of--experimental-serve-script.
angular_router
2.0.0-alpha+2
- Fixed a bug where
RouterLinkDirectivewas not keyboard accessible.
angular_forms
1.0.1-alpha+2
Maintenence release, to support the latest package:angular alpha.
angular_compiler
0.4.0-alpha+2
CompilerFlagsnow supports as afast_bootargument; default istrue.ReflectorEmitternow takes an optionaldeferredModules{Source}.
angular_ast
0.4.0
First stable release in a while! Going forward we'll be versioning this package
normally as needed to support the AngularDart template compiler and analyzer
plugin.
New features
- Add
RecursiveTemplateAstVisitor, which will visit all AST nodes accessible
from the given node. - Support
ngProjectAsdecorator on<ng-content>.
Bug fixes
DesugarVisitornow desugars AST nodes which were the (indirect) children of
EmbeddedTemplateAstnodes.
5.0.0-alpha
angular
5.0.0-alpha
We are now tracking the Dart 2.0 SDK. It is not recommended to use the
5.0.0-alpha series of releases unless you are using a recent dev release of
the Dart SDK. We plan to exit an alpha state once Dart 2.0 is released.
If you are individually depending on angular_compiler, we require:
dependencies:
angular_compiler: '^0.4.0-alpha`New features
- Both
ComponentFactoryandComponentRefare now properly typed<T>
whereTis the type of the@Component-annotated class. Prior to this
release,ComponentFactorydid not have a type, andComponentRef<T>was
alwaysComponentRef<dynamic>.
Breaking changes
-
preserveWhitespaceis nowfalseby default in@Component. The old
default behavior can be achieved by settingpreserveWhitespacetotrue. -
Classes annotated
@Componentcan no longer be treated like services that
were annotated with@Injectable(), and now fail when they are used within
aReflectiveInjector. Similar changes are planned for@Directive. -
Removed
inputsfield fromDirective. Inputs now must be declared using
inline@Inputannotations.
Bug fixes
-
Fixed a bug where injecting the
Injectorin a component/directive and
passing a second argument (as a default value) always returnednull. It
now correctly returns the second argument (closes #626). -
No longer invoke
ExceptionHandler#callwith anullexception. -
Using
Visibility.noneno longer applies to providers directly on the
@Componentor@Directive; in practice this makesnonecloser to the
localvisibility in AngularDart v1, orselfelsewhere in AngularDart;
we might consider a rename in the future. -
Fixed a bug where the hashcode of an item passed via
ngForchanging would
cause a strange runtime exception; while it is considered unsupported for
a mutable object to have an overridenhashCode, we wanted the exception
to be much better.
Refactors
- The
StylesheetCompileris now aBuilder, and is being integrated as part
of the template code genreator instead of a separate build action. This will
let us further optimize the generated code.
Performance
- Types bound from generics are now properly resolved in a component when
inheriting from a class with a generic type. For example, the following used
to be untyped:
class Container<T> {
@Input()
T value;
}
class StringContainerComponent implements Container<String> {}angular_compiler
0.4.0-alpha
While technically a breaking change from 0.3.0, it will likely be safe for
most users to set bound constraints that include 0.4.0; this will allow users
of the 4.0.0 AngularDart release to utilize the new generator_inputs
optimization.
dependencies:
angular_compiler: '>=0.3.0 <0.5.0'Breaking changes
@Componentand@Directiveannotated classes are no longer@Injectable.
In practice this means they can no loger be provided as an implicit
const Provider(FooComponent)without either manually adding@Injectable
or refactoring your code. We found this didn't really affect users, and most
uses of components and directives in these lists were accidental.
New features
- Add
generator_inputsflag support toCompilerFlags, to speed up builds
that usebarback(i.e. pub transformers). By default inpubit assumed
that all files relative to the same package have the AngularDart transformer
run on them:
lib/
foo.dart
bar.dart
This used to asynchronously block and wait for generation to complete, but at
0.3.1 will instead infer that a relative import will eventually have a
generated file:
// foo.dart
import 'bar.dart';While this could be considered a breaking change, in practice it should be
breaking only if the $include or $exclude flags are being used to control
what files have the AngularDart generator run on them. In that case, the flag
can be controlled:
transformers:
- angular:
$include:
- lib/foo.dart
generator_inputs:
- lib/foo.dart # Only foo.dart, not bar.dart.
- lib/src/**.dart # But include everything else.- Started adding experimental support for a new
Modulesyntax.
Bug fixes
- Fix a bug in the outliner that did not the correct output extension.
angular_forms
1.0.1-alpha
- Support breaking changes in angular 5.0.0-alpha
angular_test
1.0.2-alpha
- Support breaking changes in angular 5.0.0-alpha
angular_ast
0.4.0-alpha+1
- New code location! angular_ast is now part of the angular mono-repo on
https://github.com/dart-lang/angular.
Bug fix
- Fixed event name for banana syntax
[(name)]fromnameChangedto
nameChange.
angular_router-2.0.0-alpha
angular_router
2.0.0-alpha
- Major refactoring of the
angular_routerpackage. For a migration guide from
angular_routerv1, see
https://github.com/dart-lang/angular/blob/master/angular_router/g3doc/migration_guide.md.
angular_test
1.0.1
Cleanup
- Remove dependency on
angular_router.
4.0.0
We are now named package:angular instead of package:angular2. As such
you cannot pub upgrade from angular2 3.x -> angular2 4.x, and you need to
manually update your dependencies instead:
dependencies:
angular: ^4.0.0AngularDart will start tracking the upcoming Dart 2.0 alpha SDK, and as such,
4.0.0 will be the last stable release that fully supports Dart 1.24.0. We may
release small patches if needed, but otherwise the plan is to release 4.0.0 and
then immediately start working on 5.0.0-alpha, which uses the new Dart SDK.
Breaking changes
-
@Pipe-annotated classes are no longer considered@Injectable, in that
they aren't usable within aReflectiveInjector. You can get this behavior
back by adding the@Injectable()annotation to the@Pipe-annotated
class. Similar changes are in progress for@Componentand@Directive. -
PLATFORM_{PIPES|DIRECTIVES|PROVIDERS}, which was only supported in an
older version of the compiler, was removed. All of these must be manually
included in lists in an@Directiveor@Componentannotation. -
Removed
formDirectivesfromCOMMON_DIRECTIVESlist; replace
COMMON_DIRECTIVESwith[CORE_DIRECTIVES, formDirectives]for components
that use forms directives. -
Forms API has been moved to a new package,
angular_forms, which is going
to be versioned and maintained alongside the core framework. This should
allow better segmentation of code and easier contributions. -
The router package is now being published separate as
package:angular_router(not throughpackage:angular/router.dart). In the
near future it will be updated to a more Dart idiomatic "2.0" router, but
for now it is an exact replica of the previous router. -
Removed
@{Component|Directive}#queries. This is replable using the same
member-level annotation (i.e.@{Content|View}Child{ren}). -
DynamicComponentLoaderwas renamedSlowComponentLoaderto encourage
users to preferComponentLoader. Additionally, arguments
projectableNodes:andonDestroy:callbacks were removed - they were
mostly unused, and confusing since they were undocumented. -
Removed
angular/platform/browser_static.dart; replace imports with
angular/angular.dart. -
Removed
angular/platform/common_dom.dart; replace imports with
angular/angular.dart. -
Removed
angular/testing.dart; Useangular_testpackage instead. -
Removed
angular/platform/testing.dart. -
Removed
platform/testing/browser_static.dart. -
Removed
MockNgZone. -
Removed
ViewEncapsulation.native, which is no longer supported. -
Renamed
FORM_DIRECTIVEStoformDirectives. -
Removed
angular/common.dart; replace imports withangular/angular.dart. -
Removed
angular/compiler.dart; compiler should only be invoked via the
transformers or viapkg:builddirectly usingangular/source_gen.dart. -
Deprecated
@View()annotation was completely removed. -
Deprecated second parameter to
ExceptionHandlerwas completely removed. -
Removed the runtime (
dart:mirrors-based) interpreter. It is now required
to always use the AngularDart transformer to pre-compile the code, even
during development time in Dartium.package:angular2/reflection.dartwas
also removed. -
The
bootstrapfunction now always throws a runtime exception, and both it
andbootstrapStaticare accessible viaangular.dartinstead of
platform/browser.dartandplatform/browser_static.dart
#357. -
Returning
falsefrom an event handler will no longer cancel the event. See
#387 for details. -
Removed
QueryandViewQuery. Please useContentChild/ContentChildren
andViewChild/ViewChildrenin their place instead. -
Removed the
use_analyzerflag for the transformer. This is alwaystrue.
#404. -
Removed all other unused or unsupported flags from the transformer. There is
now a singleCompilerFlagsclass that is universally supported for all
build systems. -
Removed a number of classes that were never intended to be public.
-
Removed the second parameter to
ExceptionHandler, which was a no-op
anyway. -
Removed
outputsfield fromDirective. Outputs now must be declared using
inlineOutputannotations.
New features
-
Added support for functional directives: lightweight, stateless directives
that apply a one-time transformation.-
One is defined by annotating a public, top-level function with
@Directive(). -
The function parameters specify its dependencies, similar to the
constructor of a regular directive. -
Only the
selectorandprovidersparameters of the@Directive()
annotation are permitted, because the other parameters are stateful. -
The function return type must be
void.
-
@Directive(selector: '[autoId]')
void autoIdDirective(Element element, IdGenerator generator) {
element.id = generator.next();
}- Added
visibilityproperty toDirective. Directives and components that
don't need to be injected can setvisibility: Visibility.nonein their
annotation. This prevents the compiler from generating code necessary to
support injection, making the directive or component non-injectable and
reducing the size of your application.
// This component can't be injected by other directives or components.
@Component(selector: 'my-component', visibility: Visibility.none)
class MyComponent { ... }- Added
ComponentLoader, a high-level imperative API for creating components
at runtime. It uses internal code-paths that already existed, and is much
more future proof.ComponentLoaderis usable within a@Directive(), an
@Component(), and injectable services.
// An `ExampleComponent`s generated code, including a `ComponentFactory`.
import 'example.template.dart' as ng;
class AdBannerComponent implements AfterViewInit {
final ComponentLoader _loader;
AdBannerComponent(this._loader);
@override
ngAfterViewInit() {
final component = _loader.loadDetached(ng.ExampleComponentNgFactory);
// Do something with this reference.
}
}-
You can now directly inject
dart:html'sElementorHtmlElementinstead
ofElementRef, which is "soft deprecated" (will be deprecated and removed
in a future release). -
findContainerhas now been exposed from NgForm allowing easier creation of
custom form implementations. -
setUpControlhas been exposed from the forms API to allow forms to setup
their controls easier. -
Inheritance for both component and directive metadata is now complete! Any
field or method-level annotations (@Input,@Output,
@ViewChild|Children,@ContentChild|Children) are now inherited through
super types (extends,implements,with)
#231:
class BaseComponent {
@Input()
String name;
}
// Also has an input called "name" now!
@Component(selector: 'comp')
class ConcreteComponent extends BaseComponent {}- Inputs that are of type
boolnow receive a default value oftrueinstead
of a value ofnullor an empty string. This allows a much more
HTML-friendly syntax for your components:
<!-- All of these set a value of disabled=true -->
<fancy-button disabled></fancy-button>
<fancy-button [disabled]></fancy-button>
<fancy-button [disabled]="true"></fancy-button>
<!-- Value of disabled=false -->
<fancy-button [disabled]="false"></fancy-button>@Component()
class FancyButton {
@Input()
bool disabled = false;
}- Added
exports: [ ... ]to@Component, which allows the limited use of
top-level fields and static methods/fields in a template without making an
alias getter in your class. Implements
#374.
import 'dart:math' show max;
@Component(
selector: 'comp',
exports: const [
max,
],
// Should write '20'
template: '{{max(20, 10)}}',
)
class Comp {}-
Limitations:
- Only top-level fields that are
const(notfinal) can be exported.
- Only top-level fields that are
-
Added
@deferredas the first "compile-time" directive (it has no specific
runtime code nor is it listed in adirectives: [ ... ]list. Implements
#406.
import 'package:angular2/angular2.dart';
import 'expensive_comp.dart' show ExpensiveComp;
@Component(
selector: 'my-comp',
directives: const [ExpensiveComp],
template: r'''
<expensive-comp @deferred></expensive-comp>
''',
)
class MyComp {}-
Added preliminary support for component inheritance. Components now inherit
inputs, outputs, host bindings, host listeners, queries, and view queries
from all supertypes. -
We use a new open sourcing tool called "[CopyBara][]" that greatly
simplifies both releasing and taking open source contributions. We are able
to release to github more often, and accept PRs much more easily. You can
view our bleeding [github-sync][github-sync] branch for what has yet to be
merged intomaster. -
We no longer emit
ng_*.jsonfiles as part of the compile process
#276. -
Attribute selectors (
<ng-content select="custom-action[group='1']">) is
now supported [#237](https://githu...
4.0.0-beta
angular
4.0.0-beta
AngularDart will start tracking the upcoming Dart 2.0 alpha SDK, and as such,
4.0.0 will be the last stable release that fully supports Dart 1.24.0. We may
release small patches if needed, but otherwise the plan is to release 4.0.0 and
then immediately start working on 5.0.0-alpha, which uses the new Dart SDK.
Breaking changes
-
@Pipe-annotated classes are no longer considered@Injectable, in that they
aren't usable within aReflectiveInjector. You can get this behavior back by
adding the@Injectable()annotation to the@Pipe-annotated class. Similar
changes are in progress for@Componentand@Directive. -
PLATFORM_{PIPES|DIRECTIVES|PROVIDERS}, which was only supported in an older
version of the compiler, was removed. All of these must be manually included
in lists in an@Directiveor@Componentannotation.
New features
-
Added support for functional directives: lightweight, stateless directives
that apply a one-time transformation.-
One is defined by annotating a public, top-level function with
@Directive(). -
The function parameters specify its dependencies, similar to the constructor
of a regular directive. -
Only the
selectorandprovidersparameters of the@Directive()
annotation are permitted, because the other parameters are stateful. -
The function return type must be
void.
-
@Directive(selector: '[autoId]')
void autoIdDirective(Element element, IdGenerator generator) {
element.id = generator.next();
}- Added
visibilityproperty toDirective. Directives and components that
don't need to be injected can setvisibility: Visibility.nonein their
annotation. This prevents the compiler from generating code necessary to
support injection, making the directive or component non-injectable and
reducing the size of your application.
// This component can't be injected by other directives or components.
@Component(selector: 'my-component', visibility: Visibility.none)
class MyComponent { ... }Bug fixes
- Compiler now warns when annotations are added to private classes or functions.
- Compiler now warns when injecting into a field that is non-existent.
- Fixed a long-standing bug on
ngSwitchbehavior in Dartium.
Performance
- Various small reductions to the size of generated code and the runtime.
angular_router
1.0.1
- Minor internal changes to support angular 4.0.0-beta
angular_compiler
0.3.0
- Always link to
export "...template.dart" filesininitReflector(). - Catch missing field-formal (
this.) fields and warn in the compiler. - Does not emit a
registerDependenciesfunction call for empty constructors. initReflector()no longer treats@Pipeas an@Injectableservice.
4.0.0-alpha+3
angular
4.0.0-alpha+3
Breaking changes
-
Removed
formDirectivesfromCOMMON_DIRECTIVESlist; replace
COMMON_DIRECTIVESwith[CORE_DIRECTIVES, formDirectives]for components
that use forms directives. -
Forms API has been moved to a new package,
angular_forms, which is going to
be versioned and maintained alongside the core framework. This should allow
better segmentation of code and easier contributions.
Bug Fixes
- Fixed a bug in
@deferredwhen nested views has DI bindings. Fixes
#578.
angular_forms
0.1.0
- Initial commit of
angular_forms.
angular_compiler
0.2.0+1
- Various changes internal to the compiler.