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
InjectionError
andNoProviderError
, which may be thrown during
dependency injection whenInjectionError.enableBetterErrors
is 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@Component
or@Directive
. This
replaces the experimental feature@Injector.generate
, and can be used in
conjunction with theInjectorFactory
function 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
OpaqueToken
orMultiToken
as 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
extend
OpaqueToken
orMulitToken
to 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_DIRECTIVES
andCORE_DIRECTIVES
are now deprecated, and
should be replaced bycoreDirectives
. This is a no-op change (alias). -
Removed the deprecated
EventEmitter
class 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.local
to match documentation.Previously, a directive with
Visibility.local
was 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
DependencyImpl
andDependent
are constructed in the same
method, thus the instance ofDependencyImpl
could be passed directly to
Dependent
without 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
DependencyImpl
to 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@Directive
or@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
templateUrl
is 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
template
ANDtemplateUrl
are 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
template
is 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.all
was
provided for the same multi-token, after the one withVisibility.local
.
angular_router
2.0.0-alpha+6
New features
Router.onNavigationStart
now emits the requested navigation path.
angular_forms
1.0.1-alpha+6
New features
- Add
markAsUntouched
method toAbstractControl
. - Add a type annotation,
T
, toAbstractControl
, which is tied to the type
ofvalue
. ControlGroup
nowextends AbstractControl<Map<String, dynamic>>
.ControlArray
nowextends AbstractControl<List>
.
Breaking Changes
- Changed type of
AbstractControl.statusChanges
fromStream<dynamic>
to
Stream<String>
. This now matches the type forAbstractControl.status
,
which as always been aString
.
Deprecations
FormBuilder
instance methodsgroup
,control
, andarray
are now
deprecated. ForFormBuilder.control
, just callnew Control(value, validator)
directly. ForFormBuilder.group
andFormBuilder.array
, use
the static methodsFormBuilder.controlGroup
andFormBuilder.controlArray
respectively. In a future release,FormBuilder
will 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_runner
to buildangular
.
For more details, see Building Angular.
-
QueryList
is now formally deprecated. Seedoc/deprecated_query_list.md
.
This feature is not compatible with future restrictions of Dart 2, because
QueryList
was always created as aQueryList<dynamic>
, even though users
expected it to be aQueryList<T>
. The new API is fully compatible. -
SlowCompinentLoader
is 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
ngNonBindable
in the new template parser. -
Both
@Component.host
and@Directive.host
were 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'
. -
ElementRef
is now deprecated. InjectElement
orHtmlElement
instead.
This has unnecessary overhead on-top of the native DOM bindings without any
benefit.
Bug fixes
-
The experimental feature
@Injector.generate
now supports someconst
expressions in a Provider'suseValue: ...
. There are remaining known
issues with this implementation, anduseFactory
should be used instead if
you encounter issues. -
Fixed a bug where a
Injector.get
call whereInjector
is 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
, whereX
was 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
(whereY
was 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}
withElement
orHtmlElement
(fromdart:html
) caused a runtime exception, asElementRef
was 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
linkTypeOf
correctly resolves bound types (i.e.<T>
) in most cases, and
can fallback todynamic
otherwise.
Breaking changes
-
Requires
source_gen ^0.7.4+2
(was previously^0.7.0
). -
linkToReference
now requires a second parameter, aLibraryReader
, and
treats private types (i.e. prefixed with_
) asdynamic
as the compiler
cannot point to them. -
ReflectableEmitter
has been completely replaced with a new implementation. -
Removed all references and use of determining a "prefix" of a type. This was
no longer used onceReflectableEmitter
was 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.onNavigationStart
to notify subscribers when a navigation
request starts. -
Added the
routerProvidersTest
module 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 ofpopstate
events 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.onPopState
is 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 test
5.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>
whereT
is notdynamic
is
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.componentType
throws anUnsupportedError
, pending removal.
This removes our last invocation of.runtimeType
, which has potentially
severe code-size implications for some apps.- The type of
EmbeddedViewRef.rootNodes
andViewRefImpl.rootNodes
has
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
.MockLocationStrategy
should 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.deduplicateProviders
now returns aList
not 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
TypeLink
class, and replace uses ofUri
. -
Require
code_builder ^3.0.0
.
New features
-
Added
typeArgumentOf
helper 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
RangeError
that occurred when an invalid import lacked an
extension. -
ReflectorEmitter
now supportsMultiToken
and 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
-
Provider
is now soft-deprecated (not preferred), and new more-typed
classes exist:ClassProvider
,ExistingProvider
,FactoryProvider
, and
ValueProvider
. Each also has a.forToken
named constructor that infers
theProvider<T>
'sT
value 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: true
when configuring dependency injection is now
soft-deprecated (not preferred), and theMultiToken
class has been added.
AMultiToken<T>
now represents anOpaqueToken<T>
wheremulti: true
is
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/build
by 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
ReflectiveInjector
would return anObject
instead of
throwingArgumentError
when resolving an@Injectable()
service that
injected a dependency with one or more annotations (i.e.@Inject(...)
). -
Fixed a bug where
DatePipe
didn't formatmillisecondsSinceEpoch
in the
local time zone (consistent with how it formatsDateTime
).
angular_router
2.0.0-alpha+3
New features
-
Added the
CanNavigate
lifecycle interface. This is similar to
CanDeactivate
, and preferred when the nextRouterState
isn't necessary
to determine whether the router may navigate. -
Added
reload
field toNavigationParams
which can be used to force
navigation, even if the path and other navigation parameters are unchanged. -
Added
replace
field toNavigationParams
which can be used to replace the
current history entry on navigation instead of creating a new one.
Breaking changes
- Removed
hashCode
andoperator ==
overrides fromRouteDefinition
and
RouterState
, as these can't be removed by tree-shaking.
Bug fixes
- Upon destruction,
RouterOutlet
will 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
MultiToken
type.
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.none
withVisibility.local
. The former name is
misleading, as a directive is always capable of providing itself locally for
injection via another token. -
RenderComponentType
is no longer part of the public API. -
Dropped support for
@AngularEntrypoint
and 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
@deferred
does 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: false
Bug 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*ngFor
is 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
@deferred
components 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.x
releases in order
to supportangular 5.x.x
, this will now be the2.0.0
alpha release.
- Add support for the use of an externally launched
pub serve
by
using "none" as the value of--experimental-serve-script
.
angular_router
2.0.0-alpha+2
- Fixed a bug where
RouterLinkDirective
was 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
CompilerFlags
now supports as afast_boot
argument; default istrue
.ReflectorEmitter
now 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
ngProjectAs
decorator on<ng-content>
.
Bug fixes
DesugarVisitor
now desugars AST nodes which were the (indirect) children of
EmbeddedTemplateAst
nodes.
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
ComponentFactory
andComponentRef
are now properly typed<T>
whereT
is the type of the@Component
-annotated class. Prior to this
release,ComponentFactory
did not have a type, andComponentRef<T>
was
alwaysComponentRef<dynamic>
.
Breaking changes
-
preserveWhitespace
is nowfalse
by default in@Component
. The old
default behavior can be achieved by settingpreserveWhitespace
totrue
. -
Classes annotated
@Component
can 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
inputs
field fromDirective
. Inputs now must be declared using
inline@Input
annotations.
Bug fixes
-
Fixed a bug where injecting the
Injector
in 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#call
with anull
exception. -
Using
Visibility.none
no longer applies to providers directly on the
@Component
or@Directive
; in practice this makesnone
closer to the
local
visibility in AngularDart v1, orself
elsewhere in AngularDart;
we might consider a rename in the future. -
Fixed a bug where the hashcode of an item passed via
ngFor
changing 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
StylesheetCompiler
is 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
@Component
and@Directive
annotated 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_inputs
flag support toCompilerFlags
, to speed up builds
that usebarback
(i.e. pub transformers). By default inpub
it 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
Module
syntax.
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)]
fromnameChanged
to
nameChange
.
angular_router-2.0.0-alpha
angular_router
2.0.0-alpha
- Major refactoring of the
angular_router
package. For a migration guide from
angular_router
v1, 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.0
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@Component
and@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@Directive
or@Component
annotation. -
Removed
formDirectives
fromCOMMON_DIRECTIVES
list; replace
COMMON_DIRECTIVES
with[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}
). -
DynamicComponentLoader
was renamedSlowComponentLoader
to 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_test
package instead. -
Removed
angular/platform/testing.dart
. -
Removed
platform/testing/browser_static.dart
. -
Removed
MockNgZone
. -
Removed
ViewEncapsulation.native
, which is no longer supported. -
Renamed
FORM_DIRECTIVES
toformDirectives
. -
Removed
angular/common.dart
; replace imports withangular/angular.dart
. -
Removed
angular/compiler.dart
; compiler should only be invoked via the
transformers or viapkg:build
directly usingangular/source_gen.dart
. -
Deprecated
@View()
annotation was completely removed. -
Deprecated second parameter to
ExceptionHandler
was 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.dart
was
also removed. -
The
bootstrap
function now always throws a runtime exception, and both it
andbootstrapStatic
are accessible viaangular.dart
instead of
platform/browser.dart
andplatform/browser_static.dart
#357. -
Returning
false
from an event handler will no longer cancel the event. See
#387 for details. -
Removed
Query
andViewQuery
. Please useContentChild
/ContentChildren
andViewChild
/ViewChildren
in their place instead. -
Removed the
use_analyzer
flag for the transformer. This is alwaystrue
.
#404. -
Removed all other unused or unsupported flags from the transformer. There is
now a singleCompilerFlags
class 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
outputs
field fromDirective
. Outputs now must be declared using
inlineOutput
annotations.
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
selector
andproviders
parameters 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
visibility
property toDirective
. Directives and components that
don't need to be injected can setvisibility: Visibility.none
in 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.ComponentLoader
is 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
'sElement
orHtmlElement
instead
ofElementRef
, which is "soft deprecated" (will be deprecated and removed
in a future release). -
findContainer
has now been exposed from NgForm allowing easier creation of
custom form implementations. -
setUpControl
has 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
bool
now receive a default value oftrue
instead
of a value ofnull
or 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
@deferred
as 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_*.json
files 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@Component
and@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@Directive
or@Component
annotation.
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
selector
andproviders
parameters 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
visibility
property toDirective
. Directives and components that
don't need to be injected can setvisibility: Visibility.none
in 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
ngSwitch
behavior 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" files
ininitReflector()
. - Catch missing field-formal (
this.
) fields and warn in the compiler. - Does not emit a
registerDependencies
function call for empty constructors. initReflector()
no longer treats@Pipe
as an@Injectable
service.
4.0.0-alpha+3
angular
4.0.0-alpha+3
Breaking changes
-
Removed
formDirectives
fromCOMMON_DIRECTIVES
list; replace
COMMON_DIRECTIVES
with[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
@deferred
when 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.