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.