1280 Commits

Author SHA1 Message Date
Kara Erickson
aa7dba244b feat(ivy): support checkNoChanges ()
PR Close 
2018-03-11 22:16:38 -07:00
Jason Aden
0bf6fa5b32 fix(router): correct over-encoding of URL fragment ()
Relates to:  

PR Close 
2018-03-11 22:15:01 -07:00
Alex Eagle
40315bef3d fix(compiler-cli): enableResourceInlining handles both styles and styleUrls ()
When both are present, the inlined styles are appended to the end of the styles

PR Close 
2018-03-11 22:14:32 -07:00
Alex Eagle
123efba388 fix(compiler-cli): resolve resource URLs before loading them under enableResourceInlining ()
Also turn on the feature for Bazel ng_module rules

PR Close 
2018-03-11 22:14:31 -07:00
Kara Erickson
fa451bcd19 feat(ivy): support markForCheck ()
PR Close 
2018-03-09 20:29:05 -08:00
Alex Rickabaugh
0d8deb0795 fix(compiler-cli): generate proper exports.* identifiers in cjs output ()
When the compiler generates a reference to an exported variable in the
same file, it inserts a synthetic ts.Identifier node. In CommonJS
output, this synthetic node would not be properly rewritten with an
`exports.` prefix.

This change sets the TS original node property on the synthetic node
we generate, which ensures TS knows to rewrite it in CommonJS output.

PR Close 
2018-03-09 13:09:57 -08:00
Alex Eagle
b5be18f405 feat(compiler-cli): add resource inlining to ngc ()
When angularCompilerOptions { enableResourceInlining: true }, we replace all templateUrl and styleUrls properties in @Component with template/styles

PR Close 
2018-03-09 09:15:12 -08:00
Alex Eagle
1e6cc42a01 test: migrate remaining public-api tests to Bazel ()
We now create npm packages to cover all the public api assertions in tools/public_api_guard.
We no longer depend on ts-api-guardian from npm - it is now stale since the repository was archived.
There is no longer a gulp task to enforce or accept the public API, this is in CircleCI as part of running all bazel test targets.

PR Close 
2018-03-09 09:11:40 -08:00
Kara Erickson
b26a90567c feat(ivy): support attaching and detaching views from change detection ()
PR Close 
2018-03-08 23:44:33 -08:00
Chuck Jazdzewski
b0b9ca3386 feat(ivy): produce Renderer2 back-patching and factories. ()
Produces back-patch as described in the  and referenced in .

This just contains the compiler implementations and the corresponding unit
tests. Connecting the dots as described in  will be in a follow on
change.

PR Close 
2018-03-08 22:39:07 -08:00
Kara Erickson
5412e10bcd docs(core): replace ancient live demos ()
PR Close 
2018-03-08 16:43:14 -08:00
Igor Minar
489fec1299 feat: update tslib to 1.9.0 ()
BREAKING CHANGE: after this change, npm and yarn will issue incompatible peerDependencies warning

We don't expect this to actually break an application, but the application/library package.json
will need to be updated to provide tslib 1.9.0 or higher.

PR Close 
2018-03-08 16:42:34 -08:00
Misko Hevery
2fee5cc095 test(ivy): add injection canonical specs ()
PR Close 
2018-03-08 12:09:39 -08:00
Kara Erickson
f13f4db9dc refactor(ivy): fix rebase error ()
PR Close 
2018-03-08 11:37:42 -08:00
Chuck Jazdzewski
73c203fda9 feat(ivy): support host attribute and property bindings ()
PR Close 
2018-03-08 10:57:30 -08:00
Kara Erickson
4c089c1d93 feat(ivy): support ChangeDetectorRef.detectChanges ()
PR Close 
2018-03-07 21:08:25 -08:00
Kara Erickson
d485346d3c fix(ivy): lifecycle hooks should be queued for root component ()
PR Close 
2018-03-07 21:08:25 -08:00
Marc Laval
f64ee15487 feat(ivy): implement pipes ()
PR Close 
2018-03-07 20:58:48 -08:00
Marc Laval
5d4fa7f0c8 test(ivy): add canonical examples of bindings on elements ()
PR Close 
2018-03-07 20:55:49 -08:00
Kara Erickson
8fb34bcd43 refactor(forms): deprecate ngModel usage on same field as formControl ()
Support for using the `ngModel` input property and `ngModelChange`
event with reactive form directives has been deprecated in
Angular v6 and will be removed in Angular v7.

Now deprecated:
```html
<input [formControl]="control" [(ngModel)]="value">
```

```ts
this.value = 'some value';
```

This has been deprecated for a few reasons. First, developers have
found this pattern confusing. It seems like the actual `ngModel`
directive is being used, but in fact it's an input/output property
named `ngModel` on the reactive form directive that simply approximates
(some of) its behavior. Specifically, it allows getting/setting the
value and intercepting value events. However, some of `ngModel`'s other
features - like delaying updates with`ngModelOptions` or exporting the
directive - simply don't work, which has understandably caused some
confusion.

In addition, this pattern mixes template-driven and reactive forms
strategies, which we generally don't recommend because it doesn't take
advantage of the full benefits of either strategy. Setting the value in
the template violates the template-agnostic principles behind reactive
forms, whereas adding a FormControl/FormGroup layer in the class removes
the convenience of defining forms in the template.

To update your code before v7, you'll want to decide whether to stick
with reactive form directives (and get/set values using reactive forms
patterns) or switch over to template-driven directives.

After (choice 1 - use reactive forms):

```html
<input [formControl]="control">
```

```ts
this.control.setValue('some value');
```

After (choice 2 - use template-driven forms):

```html
<input [(ngModel)]="value">
```

```ts
this.value = 'some value';
```

You can also choose to silence this warning by providing a config for
`ReactiveFormsModule` at import time:

```ts
imports: [
  ReactiveFormsModule.withConfig({warnOnNgModelWithFormControl: 'never'});
]
```

Alternatively, you can choose to surface a separate warning for each
instance of this pattern with a config value of `"always"`. This may
help to track down where in the code the pattern is being used as the
code is being updated.

Note: `warnOnNgModelWithFormControl` is set up as deprecated so that it
can be removed in v7 when it is no longer needed. This will not display
properly in API docs yet because dgeni doesn't yet support deprecating
properties in object literals, but we have an open issue to resolve the
discrepancy here: https://github.com/angular/angular/issues/22640.

PR Close 
2018-03-07 20:47:53 -08:00
Miško Hevery
6d1367d297 feat(ivy): provide sanitization methods which can be tree shaken ()
By providing a top level sanitization methods (rather than service) the
compiler can generate calls into the methods only when needed. This makes
the methods tree shakable.

PR Close 
2018-03-07 18:24:07 -08:00
Miško Hevery
538f1d980f refactor(core): move sanitization into core ()
This is in preparation of having Ivy have sanitization inline.

PR Close 
2018-03-07 18:24:06 -08:00
Olivier Combe
78167915ee build(common): export locale data as commonjs instead of es2015 ()
PR Close 
2018-03-07 14:33:45 -08:00
Alex Eagle
ce649f725f build: add a ng_package rule for @angular/router ()
PR Close 
2018-03-07 10:56:27 -08:00
Alex Eagle
fcb8c492d6 build: add an npm_package rule for @angular/bazel ()
PR Close 
2018-03-07 10:56:27 -08:00
Miško Hevery
363dfa5437 test(ivy): Back patch example ()
PR Close 
2018-03-06 15:02:02 -08:00
Alex Eagle
4c40812b71 fix(bazel): fixes for ng_package on Windows ()
PR Close 
2018-03-06 07:52:48 -08:00
Jason Aden
fa974c7d4e fix(router): fix URL serialization so special characters are only encoded where needed ()
This change brings Angular largely in line with how AngularJS previously serialized URLs. This is based on RFC 3986 and resolves issues such as the above  where URLs could be parsed, re-serialized, then parsed again producing a different result on the second parsing.

Adjustments to be aware of in this commit:

* URI fragments will now serialize the same as query strings
* In the URI path or segments (portion prior to query string and/or fragment), the plus sign (`+`) and ampersand (`&`) will appear decoded
* In the URL path or segments, parentheses values (`(` and `)`) will now appear percent encoded as `%28` and `%29` respectively
* In the URL path or segments, semicolons will be encoded in their percent encoding `%3B`

NOTE: Parentheses and semicolons denoting auxillary routes or matrix params will still appear in their decoded form -- only parentheses and semicolons used as values in a segment or key/value pair for matrix params will be encoded.

While these changes are not considered breaking because applications should be decoding URLs and key/value pairs, it is possible that some unit tests will break if comparing hard-coded URLs in tests since that hard coded string will represent the old encoding. Therefore we are releasing this fix in the upcoming Angular v6 rather than adding it to a patch for v5.

Fixes: 

PR Close 
2018-03-06 06:58:08 -08:00
Pawel Kozlowski
2c75acc5b3 feat(ivy): add support for the ngProjectAs attribute ()
PR Close 
2018-03-06 06:55:51 -08:00
Suguru Inatomi
f86d8ae0fd docs(compiler): fix a line about ivy library ()
PR Close 
2018-03-05 21:25:43 -08:00
Kara Erickson
2c2b62f45f fix(ivy): preventDefault when listener returns false ()
Closes 

PR Close 
2018-03-05 12:15:17 -08:00
Misko Hevery
51ca643c27 test(ivy): add injectAttribute spec ()
PR Close 
2018-03-05 10:10:32 -08:00
Misko Hevery
69d359bb51 refactor(ivy): break compiler canonical test into smaller files ()
PR Close 
2018-03-05 10:10:32 -08:00
Alex Eagle
ba8df8a3f1 build: update to latest bazel rules ()
PR Close 
2018-03-02 13:27:25 -08:00
Chuck Jazdzewski
0451fd93df feat(ivy): support generating view and content queries ()
PR Close 
2018-03-01 13:06:47 -08:00
Chuck Jazdzewski
49f074f61d feat(ivy): support array and object literals in binding expressions ()
PR Close 
2018-03-01 13:02:58 -08:00
Rado Kirov
ab790f3c84 build: Add support for bazelOptions.maxCacheSizeMb in ngc-wrapped. ()
PR Close 
2018-03-01 08:41:10 -08:00
Alex Rickabaugh
dd534471ec fix(compiler): allow tree-shakeable injectables to depend on string tokens ()
Previously the injectable compiler assumed all tree-shakeable injectables
would have dependencies that were injectables or InjectionTokens. However
old code still uses string tokens (e.g. NgUpgrade and '$injector'). Using
such tokens would cause the injectable compiler to crash.

Now, the injectable compiler can properly generate a dependency on such a
string token.

PR Close 
2018-03-01 08:15:13 -08:00
Chuck Jazdzewski
8bb2f5c71d docs(compiler): ivy separate compilation design document ()
PR Close 
2018-03-01 08:14:35 -08:00
Hans Larsen
288851c41e release: add ng update package group metadata to angular ()
"ng update" supports having multiple packages as part of a group which should be updated together, meaning that e.g. calling "ng update @angular/core" would be equivalent to updating all packages of the group (that are part of the package.json already).

In order to support the grouping feature, the package.json of the version the user is updating to needs to include an "ng-update" key that points to this metadata.

The entire specification for the update workflow can be found here: 2e8b12a4ef/docs/specifications/update.md

PR Close 
2018-02-28 14:57:53 -08:00
Kara Erickson
9eaf1bbe67 feat(ivy): support injecting ChangeDetectorRef ()
PR Close 
2018-02-28 13:35:48 -08:00
Alex Eagle
aabe16c08c fix(bazel): ng_package includes transitive .d.ts and flatModuleMetadata ()
Fixes 

PR Close 
2018-02-28 13:29:56 -08:00
Alex Eagle
b6c941053e feat(bazel): ng_package adds package.json props ()
We now add the 'main', 'module', 'es2015', and 'typings' properties,
pointing to where the packaging tool lays them out.

Fixes 

PR Close 
2018-02-28 13:29:56 -08:00
Alex Rickabaugh
f8749bfb70 fix(core): export inject() from @angular/core ()
inject() supports the ngInjectableDef-based configuration of the injector
(otherwise known as tree-shakeable services). It was missing from the
exported API of @angular/core, this PR adds it.

The test added here is correct in theory, but may pass accidentally due
to the decorator side-effect replacing the inject() call at runtime. An
upcoming compiler PR will strip reified decorators from the output
entirely.

Fixes 

PR Close 
2018-02-28 10:44:37 -08:00
Kara Erickson
8c358844dd feat(ivy): support OnPush change detection ()
PR Close 
2018-02-28 10:42:11 -08:00
Kara Erickson
e454c5a98e refactor(ivy): store creationMode in LView.flags ()
PR Close 
2018-02-28 10:42:11 -08:00
George Kalpakas
8a85888773 fix(upgrade): correctly destroy nested downgraded component ()
Previously, when a downgraded component was destroyed in a way that did
not trigger the `$destroy` event on the element (e.g. when a parent
element was removed from the DOM by Angular, not AngularJS), the
`ComponentRef` was not destroyed and unregistered.
This commit fixes it by listening for the `$destroy` event on both the
element and the scope.

Fixes 

PR Close 
2018-02-27 18:41:02 -08:00
Adam Plumer
40ba009e25 fix(platform-server): generate correct stylings for camel case names ()
* Add correct mapping from camel case to kebab case for CSS style
names
* Remove internal CSS methods in favor of native Domino APIs

Fixes 

PR Close 
2018-02-26 17:46:21 -08:00
Adam Plumer
d3827a0017 feat(platform-server): bump Domino to v2.0 ()
BREAKING CHANGE:

* Bump the dependency on Domino to 2.0 to resolve issues with
  namespacing

PR Close 
2018-02-26 14:55:52 -08:00
George Kalpakas
13ab91e05d fix(upgrade): fix empty transclusion content with AngularJS@>=1.5.8 ()
The function provided by `ngUpgrade` as `parentBoundTranscludeFn` when
upgrading a component with transclusion, will break in AngularJS v1.5.8+
if no transclusion content is provided. The reason is that AngularJS
will try to destroy the transclusion scope (which would not be needed
any more). But since the transcluded content comes from Angular, not
AngularJS, there is no transclusion scope to destroy.
This commit fixes it by providing a dummy scope object with a no-op
`$destroy()` method.

Fixes 

PR Close 
2018-02-25 10:06:14 -08:00