5.0.0-alpha+10
angular
5.0.0-alpha+10
Breaking changes
-
The minimum SDK version is now
sdk: ">=2.0.0-dev.46.0 <2.0.0". -
The process for starting your AngularDart application changed significantly:
-
For most applications, we recommend now strongly recommend using the new
runAppfunction. Instead of starting your application by passing the
Typeof an@Component-annotatedclass, you now pass a
ComponentFactory, the generated code for a component:import 'package:angular/angular.dart'; // ignore: uri_has_not_been_generated import 'main.template.dart' as ng; void main() { runApp(ng.RootComponentNgFactory); } @Component( selector: 'root', template: 'Hello World', ) class RootComponent {}
To provide top-level services, use the
createInjectorparameter, and
pass a generatedInjectorFactoryfor a top-level annotated with
@GenerateInjector:import 'package:angular/angular.dart'; // ignore: uri_has_not_been_generated import 'main.template.dart' as ng; void main() { runApp(ng.RootComponentNgFactory, createInjector: rootInjector); } class HelloService { void sayHello() => print('Hello!'); } @GenerateInjector(const [ const ClassProvider(HelloService), ]) final InjectorFactory rootInjector = ng.rootInjector$Injector;
A major difference between
runAppand previous bootstrapping code is
the lack of theinitReflector()method or call, which is no longer
needed. That means usingrunAppdisables the use of
SlowComponentLoaderandReflectiveInjector, two APIs that require
this extra runtime metadata.To enable use of these classes for migration purposes, use
runAppLegacy:import 'package:angular/angular.dart'; // ignore: uri_has_not_been_generated import 'main.template.dart' as ng; void main() { runAppLegacy( RootComponent, createInjectorFromProviders: [ const ClassProvider(HelloService), ], initReflector: ng.initReflector, ); }
NOTE:
initReflectorandrunAppLegacydisables tree-shaking on
any class annotated with@Componentor@Injectable. We strongly
recommend migrating to therunApppattern. -
The
APP_INITIALIZERStoken was removed. The closest functionality
(running a function that returns aFuturebefore creating the root
component) is usingrunAppAsyncorrunAppLegacyAsyncfunctions with
abefofreComponentCreatedcallback:import 'dart:async'; import 'package:angular/angular.dart'; // ignore: uri_has_not_been_generated import 'main.template.dart' as ng; Future<String> fetchSomeText() => ... void main() { runApp( ng.RootComponentNgFactory, beforeComponentCreated: (injector) { final prefetch = injector.get(Prefetch) as Prefetch; return prefetch.prefetchSomeData(); }, // @GenerateInjector could be used instead. This is a simple example. createInjector: (parent) { return new Injector.map({ Prefetch: new Prefetch(); }, parent); }, ); } @Component( selector: 'root', template: 'Hello World', ) class RootComponent {} class Prefetch { Future<void> prefetchSomeData() => ... }
-
The top-level function
bootstrapwas deleted. This function always
threw a runtime exception since5.0.0-alpha+5, and was a relic of when
a code transformer rewrote it automatically asbootstrapStatic. -
The top-level function
bootstrapStaticis now deprecated. The
closest equivalent is the newrunAppLegacy_orrunAppLegacyAsync
functions.
-
-
The interface
PlatformRef(andPlatformRefImpl) were removed. They were
not used, and added an unnecessary code-size overhead to every application. -
Removed the deprecated
QueryListclass,Listis used instead, only. -
Removed
ApplicationRef.registerBootstrapListener, which was unused.
New features
-
The compiler now warns when a
@Component.stylesseems to reference a file
on disk, such asstyles: const ['a.css'](this is usually an accident). We
already warned fortemplate: 'a.html'. -
Running within an angular zone will no longer cause addtional turns to occur
within it's parent's zone. ngZone's run() will now run inside the parent
zone's run() function as opposed to the other way around.
Internal cleanup
- Add explicit error for when angular codegen is not invoked, the previous
error was "Could not find a factory for X" but this is not the real issue
since none of the factories had been loaded due to lack of angular codegen.
angular_ast
0.5.1
-
The minimum SDK version is now
sdk: ">=2.0.0-dev.46.0 <2.0.0". -
The
*micro-syntax now supports binding to the primary input when followed
by additional input orletbindings. Previously the micro-syntax supported
binding to the primary input only in isolation.Example usage enabled by this change.
Before:
<template [foo]="expr1" [fooContext]="expr2"> <div></div> </template>
After:
<div *foo="expr1; context: expr2"></div>
angular_compiler
0.4.0-alpha+10
- Maintenance release.
- The minimum SDK version is now
sdk: ">=2.0.0-dev.46.0 <2.0.0".
angular_forms
2.0.0-alpha+2
Breaking Changes
-
The minimum SDK version is now
sdk: ">=2.0.0-dev.46.0 <2.0.0". -
Add
ControlValueAccessor.onDisabledChanged()method. All implementations
ofControlValueAccessorneed to add this method. -
Remove
includeandexcludemethods fromControlGroup. These can be
replaced with calls tomarkAsEnabledandmarkAsDisabledinstead.Before:
controlGroup.include('foo');After:
controlGroup.controls['foo'].markAsEnabled(); -
CheckboxControlValueAccessornow implementsControlValueAccessor<bool>
andRadioControlValueAccessornow implements
ControlValueAccessor<RadioButtonState>. Previously, they were both
ControlValueAccessor<dynamic>.
angular_router
2.0.0-alpha+10
Breaking changes
- The minimum SDK version is now
sdk: ">=2.0.0-dev.46.0 <2.0.0".
Bug fixes
- Router navigation requests are now queued to ensure they'll run sequentially
in the order they were requested. Previously no attempt was made to
synchronise navigation requests, and if multiple were made simultaneously
they could run concurrently, interfere with each other, and potentially
complete out of order.
angular_test
2.0.0-alpha+8
-
The minimum SDK version is now
sdk: ">=2.0.0-dev.46.0 <2.0.0". -
DEPRECATED:
throwsInAngularis now a no-op, and can be removed.