5.0.0-alpha+11
angular
5.0.0-alpha+11
Breaking changes
-
Removed
ApplicationRef.injectorfrom the public API. This was a sparingly
used API, and it was usually incorrect to specifically use this injector
over the current injector in the component context or the root component's
Injector. -
Removed the experimental
parentargument toApplicationRef.bootstrap.
It is no longer needed since all applications use the same bootstrap code
branch (eitherrunApp, or code that eventually runs throughrunApp). -
Removed the rarely used
templateattribute syntax. Uses can be replaced
with either the*micro-syntax, or a<template>element.Before
<div template="ngFor let item of items; trackBy: trackById; let i=index"> {{i}}: {{item}} </div>
After
<!-- * micro-syntax --> <div *ngFor="let item of items; trackBy: trackById; let i=index"> {{i}}: {{item}} </div> <!-- <template> element --> <template ngFor let-item [ngForOf]="items" [ngForTrackBy]="trackById" let-i="index"> <div> {{i}}: {{item}} </div> </template>
New features
-
The new
Modulesyntax for dependency injection is shipped! This is an
optional feature instead of using nestedconstlists to represent sets
of shared providers. For example, instead of the following:const httpModule = const [ /* Other providers and/or modules. */ ]; const commonModule = const [ httpModule, const ClassProvider(AuthService, useClass: OAuthService), const FactoryProvider.forToken(xsrfToken, useFactory: readXsrfToken), ];
... you can represent this with the new typed
Modulesyntax:const httpModule = const Module( /* ... Configuration ... */); const commonModule = const Module( include: const [httpModule], provide: const [ const ClassProvider(AuthService, useClass: OAuthService), const 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.Modulespecifically outlines that order is significant, and
thatincludeis processed beforeprovide. -
Modulerejects using aTypeimplicitly as aClassProvider. This
removes additional ambiguity around supportingList<dynamic>, and while
more verbose, should lead to more correct use. -
Moduletends to be more understandable by users of other dependency
injection systems such as Guice or Dagger, and reads better than aconst
List(which is a very Dart-only idiom).
We're not yet updating the [style guide]
(https://github.com/dart-lang/angular/blob/master/doc/effective/di.md) in
this release, but we are looking for users to help validate that this is
the way to go for the future.NOTE: It is also possible to use
Modulein@GenerateInjector:@GenerateInjector.fromModules(const [ const Module( include: const [ const Module( provide: const [ const ValueProvider(ExampleService, const ExampleService()), ], ), ], provide: const [ const ValueProvider(ExampleService2, const ExampleService2()), const ExistingProvider(ExampleService, ExampleService2), ], ), ]) final InjectorFactory exampleFromModule = ng.exampleFromModule$Injector;
NOTE: It is also possible to use
ModuleinReflectiveInjector:// Using ReflectiveInjector is strongly not recommended for new code // due to adverse effects on code-size and runtime performance. final injector = ReflectiveInjector.resolveAndCreate([ const Module( include: const [ const Module( provide: const [ const ValueProvider(ExampleService, const ExampleService()), ], ), ], provide: const [ const ValueProvider(ExampleService2, const ExampleService2()), const ExistingProvider(ExampleService, ExampleService2), ], ), ]);
-
-
@HostListener()can now automatically infer theconst ['$event']
parameter when it is omitted but the bound method has a single argument:class Comp { @HostListener('click') void onClick(MouseEvent e) {} }
Bug fixes
-
The
*micro-syntax now supports newlines after an identifier. -
The compiler is now reporting errors again for invalid property bindings on
<template>elements.
angular_ast
0.5.2
- The
*micro-syntax now supports newlines after an identifier.
angular_compiler
0.4.0-alpha+11
- Added
ModuleReader.extractProviderObjectsto use in the view compiler. - Added
logFineas a new top-level API.
angular_forms
2.0.0-alpha+3
New Features
- Add
ngDisabledinput to all Control directives.
Breaking Changes
-
NgControlGroupcan no longer be injected directly. It can still be
injected as aControlContainer. -
NgControlNameandNgFormControlcan no longer be injected directly. They
can still be injected as aNgControl. -
CheckboxControlValueAccessor,DefaultValueAccessor,
NumberValueAccessor,RadioControlValueAccessor, andNgSelectOptioncan
no longer be injected directly.
angular_router
2.0.0-alpha+11
New features
- Added the method
navigateByUrltoRouter.
angular_test
2.0.0-alpha+9
pub run angular_testwas entirely removed. This hasn't worked since
2.0.0-alpha+3, but instead threw an error message reminding users it was
no longer supported.