Currently, the only way for a directive to export a validator is by providing a function. This makes it ackward to write validators that depend on directive inputs. In addition to supporting functions as validators, classes implementing the Validator interface are supported too.
The current code doesn't function properly:
- assert are never activated
- even if activated would result in infinite loop
Since the code is broken and blocks other use-cases
this commit turns assert into noop. A proper solution
for asserts will be part of #2830Fixes#4981Closes#4983
We've had issues such as the one I documented: https://github.com/Microsoft/TypeScript/issues/5187
This tslint check prevents this happening again.
This change also updates to the newest tslint which gets typings from npm.
Closes#4970
Match [ViewResolver][]'s semantics for reading template and style values
from `@Component` and `@View` annotations.
We now warn if template and/or style values appear on an `@Component`
annotation and a `@View` annotation is present.
[ViewResolver]: 7c6130c2c5/modules/angular2/src/core/linker/view_resolver.ts
Previously, importing a library twice using different prefixes could
cause the template compiler step to incorrect omit `Directive`
dependencies provided by that library.
Previously, we parsed dependencies out of a the stringified value of
`directives`, which is brittle and error-prone.
Move this parsing into `DirectiveProcessor` where we have the full Dart
ast to help.
Previously, `DeferredRewriter` checked for the existence of
`.ng_deps.dart` files to determine which deferred libraries it needed to
rewrite, requiring that those assets exist at the time it was run.
Update to check for `.ng_meta.json` files instead, which exist after the
`DirectiveProcessor` phase. This allows the `DeferredRewriter` (which
only processes *.dart files) to run in
parallel with `TemplateComplier` (which only processes *.ng_meta.json
files) and `StylesheetCompiler` (which only processes *.css files).
Have DeferredRewriter to check existence of .ng_meta.json assets rather than .ng_deps.dart assets
Update `DirectiveProcessor` and `TemplateCompiler` to generate the
getters, setters, and methods currently generated in `BindGenerator`.
Update `DirectiveMetadataLinker` to output `.ng_meta.json` files instead
of `.ng_deps.dart` files, avoiding full codegen until the last phase.
This allows us to dedupe codegen logic and remove an additional phase
from the transformer.
- fixes wrapping for object literal keys called `template`.
- spacing in destructuring expressions.
- changes to keep trailing return types of functions closer to their
function declaration.
- better formatting of string literals.
Closes#4828
Example:
var login = new Control("someLogin");
c.setErrors({"notUnique": true});
expect(c.valid).toEqual(false);
expect(c.errors).toEqual({"notUnique": true});
c.updateValue("newLogin");
expect(c.valid).toEqual(true);
BREAKING CHANGE:
Before:
ControlGroup.errors and ControlArray.errors returned a reduced value of their children controls' errors.
After:
ControlGroup.errors and ControlArray.errors return the errors of the group and array.
And ControlGroup.controlsErrors and ControlArray.controlsErrors return the reduce value of their children controls' errors.
Closes#4917