Commit Graph

4998 Commits

Author SHA1 Message Date
Tobias Bosch a05e50fda3 feat(core): view engine - add missing DI features (#14225)
Part of #14013

PR Close #14225
2017-02-01 14:16:01 -06:00
Tobias Bosch ae7f5f37d2 refactor(core): view engine - remove `ViewData.parentDiIndex` (#14225)
Instead, calculate it on the fly

Part of #14013
2017-02-01 14:15:47 -06:00
Tobias Bosch 45e1e36477 feat(core): view engine - add support for `OnPush` and detached views. (#14216)
Part of #14013

PR Close #14216
2017-02-01 14:15:47 -06:00
Tobias Bosch 08ff67ea11 feat(core): view engine - add `WrappedValue` support (#14216)
Part of #14013
2017-02-01 14:15:38 -06:00
Miško Hevery 1bc5368ea0 fix: closure compiler warning (#14229)
PR Close #14229
2017-02-01 14:11:52 -06:00
Dzmitry Shylovich 093cc04748 fix(common): DatePipe parses input string if it's not a valid date in browser (#13895)
Closes #12334
Closes #13874

PR Close #13895
2017-02-01 14:01:58 -06:00
Dzmitry Shylovich 9d2c71269b refactor(common): remove isDate from facade (#13895) 2017-02-01 14:01:46 -06:00
Tobias Bosch 0a29574d98 feat(core): view engine - support content projection (#14209)
Part of #14013

PR Close #14209
2017-02-01 09:29:51 -06:00
Chuck Jazdzewski 86b2b2504f feat(common): rename underlying `NgFor` class and add a type parameter (#14104)
Note, this affects the underlying class and should not affect usage.

DEPRECATION:
- the `NgFor` class is now deprecated. Use `NgForOf<T>` instead.
  IMPORTANT: Only the `NgFor` class is deprecated, not the `ngFor`
  directive. The `*ngFor` and related directives are unaffected by
  this change  as references to the `NgFor` class generated from
  templates will be automatically converted to references to
  `NgForOf<T>` without requiring any template modifications.
- `TrackByFn` is now deprecated. Use `TrackByFunction<T>` instead.

Migration:
- Replace direct references to the `NgFor` class to `NgForOf<any>`.
- Replace references to `TrackByFn` to `TrackByFunction<any>`.

BREAKING CHANGE:
A definition of `Iterable<T>` is now required to correctly compile
Angular applications. Support for `Iterable<T>` is not required at
runtime but a type definition `Iterable<T>` must be available.

`NgFor`, and now `NgForOf<T>`, already supports `Iterable<T>` at
runtime. With this change the type definition is updated to reflect
this support.

Migration:
- add "es2015.iterable.ts" to your tsconfig.json "libs" fields.

Part of #12398

PR Close #14104
2017-02-01 09:29:51 -06:00
Chuck Jazdzewski 69e14b500b feat(compiler): generate type parameters for generic type references (#14104) 2017-02-01 09:29:51 -06:00
Georgios Kalpakas 7670cc1a86 feat(upgrade): export VERSION from `upgrade/static` (#14037)
PR Close #14037
2017-02-01 09:29:51 -06:00
Georgios Kalpakas ea63676970 refactor(upgrade): use shared code in `downgradeNg2Component()` (#14037)
This unified the implementations of dynamic's `downgradeNg2Component()` and
static's `downgradeComponent()`.
2017-02-01 09:29:51 -06:00
Georgios Kalpakas 1367cd9569 fix(upgrade): respect hierarchical injectors for downgraded components (#14037)
Correctly wire up hierarchical injectors for downgraded components in
`upgrade/static`: Downgraded components inherit the injector of the first
downgraded component up the DOM tree.

This is similar to (part of) d91a86a, but for `upgrade/static`.

POSSIBLE BREAKING CHANGE:

In order to enable more control over the wiring of downgraded components and
their content (which eventually allows better control over features like
injector setup and content projection), it was necessary to change the
implementation of the directives generated for downgraed components.

The directives are now terminal and manually take care of projecting and
compiling their contents in the post-linking function. This is similar to how
the dynamic version of `upgrade` does it.

This is not expected to affect apps, since the relative order of individual
operations is preserved. Still, it is difficult to predict how every possible
usecase may be affected.
2017-02-01 09:29:51 -06:00
Georgios Kalpakas 9aafdc7b02 feat(upgrade): allow non-element selectors for downgraded components (#14037)
This affects the dynamic version of `upgrade` and makes it more consistent with
the static version, while removing an artificial limitation.

This commit also refactors the file layout and code, in order to share code wrt
to dowgrading components between the dynamic and static versions.
2017-02-01 09:29:51 -06:00
Georgios Kalpakas 1f90f29369 feat(upgrade): return a function (instead of array) from `downgradeInjectable()` (#14037)
This makes it more consistent with the dynamic version of `upgrade` and makes it
possible to share code between the dynamic and static versions.

This commit also refactors the file layout, moving common and dynamic-specific
files to `common/` and `dynamic/` directories respectively and renaming `aot/`
to `static/`.

Some private keys, used as AngularJS DI tokens, have also been renamed, but this
should  not affect apps, since these keys are undocumented and not supposed to
be used externally.

BREAKING CHANGE:

Previously, `upgrade/static/downgradeInjectable` returned an array of the form:

```js
['dep1', 'dep2', ..., function factory(dep1, dep2, ...) { ... }]
```

Now it returns a function with an `$inject` property:

```js
factory.$inject = ['dep1', 'dep2', ...];
function factory(dep1, dep2, ...) { ... }
```

It shouldn't affect the behavior of apps, since both forms are equally suitable
to be used for registering AngularJS injectable services, but it is possible
that type-checking might fail or that current code breaks if it relies on the
returned value being an array.
2017-02-01 09:29:51 -06:00
Miško Hevery e0e5e78835 fix: lint errors to make circle-ci green 2017-01-31 19:01:48 -06:00
Alex Eagle b4214d60a6 fix(compiler): allow expressions or functions in extends (#14158)
Fixes #14154

PR Close #14158
2017-01-31 18:35:10 -06:00
Victor Berchet 5921c872b6 fix(compiler): only lex messages that are needed by angular (#14208)
To avoid the lexer erroring on syntax not supported by Angular.

PR Close #14208
2017-01-31 16:21:55 -06:00
Tobias Bosch 52b21275f4 feat(core): view engine - add debug information (#14197)
Creates debug information for the renderer,
and also reports errors relative to the
declaration place in the template.

Part of #14013

PR Close #14197
2017-01-31 16:21:54 -06:00
Chuck Jazdzewski 49fb8143e8 fix(language-service): do not crash when Angular cannot be located (#14123)
Fixes #14122

PR Close #14123
2017-01-31 15:45:52 -06:00
cexbrayat 5f2b3173d7 fix(http): use params without RequestOptions (#14101)
`params` has been introduced in 4.0.0-beta.0

Before:

    http.get(url, new RequestOptions({params: searchParams}))

After:

    http.get(url, {params: searchParams})

Fixes #14100

PR Close #14101
2017-01-31 15:44:49 -06:00
evan Liu c87c3bec93 feat(router): deprecate preserveQueryParams,add queryParamsHandling (#14095)
PR Close #14095
2017-01-31 15:43:25 -06:00
Dzmitry Shylovich 2ffa1a71aa docs(forms): fix FormArray description (#14094)
Closes #14075

PR Close #14094
2017-01-31 15:42:42 -06:00
Toxicable 94f84c5d7e fix(forms): Verify functions passed into async validators returns Observable or Promise (#14053) 2017-01-31 12:15:56 -06:00
Dzmitry Shylovich ff290af38c fix(common): introduce isObservable method (#14067)
Closes #8848

PR Close #14067
2017-01-31 12:14:19 -06:00
Dzmitry Shylovich fe441186e7 fix(common): add PopStateEvent interface (#13400)
Closes #13378

PR Close #13400
2017-01-31 12:08:54 -06:00
Dzmitry Shylovich f89d004c51 fix(forms): provide a method to compare options (#13349)
Closes #13268

PR Close #13349
2017-01-31 11:38:30 -06:00
Dzmitry Shylovich 6c7300c7de fix(forms): async validator cancels previous subscription when input has changed (#13222)
Fixes #12709
Fixes #9120
Fixes #10074
Fixes #8923

PR Close #13222
2017-01-31 11:37:25 -06:00
Alex Eagle 22058298d3 fix(closure): suppress some closure compiler warnings (#14198)
PR Close #14198
2017-01-30 18:34:14 -06:00
Dzmitry Shylovich 1df9319af1 fix(forms): fix broken unit test (#14179) 2017-01-30 10:07:09 -08:00
Toxicable 7b7ae5fe56 feat(forms): add equalsTo validator (#14052)
PR Close: #14052
2017-01-29 12:22:24 -06:00
WilliamKoza 94b62c963d fix(common) add interface PipeTransform to Async pipe (#14049)
PR Close #14049
2017-01-29 12:18:55 -06:00
Dzmitry Shylovich 579567ca79 fix(router): fix CanActivateChild guard provided in a lazy loaded module (#13989)
Closes #12275

PR Close #13989
2017-01-29 12:17:03 -06:00
Dzmitry Shylovich 47d41d492b fix(router): fix navigation from the root component ngOnInit hook (#13932)
Closes #13795

PR Close #13932
2017-01-29 12:16:12 -06:00
Dzmitry Shylovich e075b1ba83 fix(router): fix CanActivate redirect to the root on initial load (#13929)
Closes #13530

PR Close #13929
2017-01-29 12:15:46 -06:00
Dzmitry Shylovich 029f558d45 fix(forms): select shows blank line when nothing is selected in IE/Edge (#13903)
Closes #10010

PR Close #13903
2017-01-29 12:15:11 -06:00
执衡 c5ea03a023 feat(ngModel):handle ime events (#13891)
PR Close: #13891
2017-01-29 12:14:32 -06:00
Dzmitry Shylovich cd3901f774 fix(platform-browser): remove style nodes on destroy (#13744)
Closes #11746

PR Close #13744
2017-01-29 12:10:44 -06:00
Dzmitry Shylovich a64c9b5d5b refactor(platform-browser): polishing (#13744) 2017-01-29 12:10:39 -06:00
Dzmitry Shylovich 863285a4b0 fix(core): add bootstrapped modules into platform modules list (#13740)
Closes #12015

PR Close #13740
2017-01-29 12:09:46 -06:00
Dimitri Benin 5f40e5ba21 fix(testing): async/fakeAsync/inject/withModule helpers should pass through context to callback functions (#13718)
Make sure that context (`this`) that is passed to functions generated by test helpers is passed through to the callback functions. Enables usage of Jasmine's variable sharing system to prevent accidental memory leaks during test runs.
2017-01-29 12:08:53 -06:00
Dzmitry Shylovich d69717cf79 feat(forms): add email validator (#13709)
Closes #13706

PR Close #13709
2017-01-29 12:07:05 -06:00
Georgios Kalpakas 00979838ef refactor(upgrade): allow Closure advanced optimizations in `UpgradeComponent` (#13629)
Get rid of the dynamic invocation style used in `callLifecycleHook()`, which
would break under Closure Compiler's advanced optimizations.
Related to https://github.com/angular/angular/pull/13020#discussion_r93492935.

PR Close #13629
2017-01-29 12:02:52 -06:00
Dzmitry Shylovich a277e97dd7 fix(core): ViewContainerRef.indexOf doesn't throw error when empty (#13220)
PR Close #13220
2017-01-29 11:50:23 -06:00
Dzmitry Shylovich 9e5617e41e fix(http): remove dots from jsonp callback name (#13219)
PR Close #13219
2017-01-29 11:49:40 -06:00
Nuno Arruda 0854a5dea4 style(docs): update copyright years (#13736) 2017-01-27 20:47:14 -08:00
Jason Aden c37af2af5a refactor(core): simplify ReflectiveInjector by removing code for Dart implementation (#14126)
ReflectiveInjector previously used two strategies for resolving dependencies. These
were to support the Dart implementation, but are no longer needed. A result of this
PR is there is no longer a 20 dependency limit and the generated code is smaller.

PR Close #14126
2017-01-27 13:22:32 -08:00
Igor Minar da41a954b5 docs: branding fixes (#14132)
Angular 1.x -> AngularJS
Angular 1 -> AngularJS
Angular1 -> AngularJS
Angular 2+ -> Angular
Angular 2.0 -> Angular
Angular2 -> Angular

I have deliberately not touched any of the symbol names as that would cause big merge collisions with Tobias's work.

All the renames are in .md, .json, and inline comments and jsdocs.

PR Close #14132
2017-01-27 15:03:11 -06:00
Igor Minar 5a997ef4f0 docs: remove obsolete bundles/overview.md file (#14132) 2017-01-27 15:02:59 -06:00
Misko Hevery d339d8b81d refactor(abstract): Use abstract keyword where possible to decrease file size. (#14112)
PR Close: #14112
2017-01-27 12:32:22 -08:00
Victor Berchet 827c3fe199 fix(compiler): fix missing translations handling (#14113)
PR Close #14113
2017-01-27 12:12:06 -06:00
Gion Kunz 8775ab9495 feat(compiler): allow missing translations (#14113)
closes #13861
2017-01-27 12:10:59 -06:00
Victor Berchet 5885c52c1f refactor(compiler): add ability to get the context around a `ParseLocation` (#14113) 2017-01-27 12:10:47 -06:00
Tobias Bosch f802194c18 refactor(core): have different data types for each node. (#14120)
Also have a new node type for queries.

This leads to less memory usage and better performance.

Deep Tree Benchmark results (depth 11):
- createAndDestroy (view engine vs current codegen):
  * pureScriptTime: 78.80+-4% vs 72.34+-4%
  * scriptTime: 78.80+-4% vs 90.71+-9%
  * gc: 5371.66+-108% vs 9717.53+-174%
  * i.e. faster when gc is also considered and about 2x less memory usage!
- update unchanged

Part of #14013
PR Close #14120
2017-01-27 12:08:54 -06:00
Dzmitry Shylovich 7ad616a177 fix(common): DatePipe doesn't throw for NaN (#14117)
Fixes #14103

PR Close #14117
2017-01-27 12:07:47 -06:00
Misko Hevery 670b680b0a refactor(size): Use abstract keyword where possible to decrease file size. (#14112) 2017-01-27 12:00:58 -06:00
Victor Berchet f7fba74c58 feat(compiler): do not parse xtb messages not needed by angular (#14111)
fixes #14046

PR Close #14111
2017-01-27 11:52:57 -06:00
Peter Bacon Darwin 20b454cbc9 fix(upgrade): detect async downgrade component changes (#14039)
This commit effectively reverts 7e0f02f but for `upgrade/static`
as it was an invalid fix for #6385, that created a more significant
bug, which was that changes were not always being detected.

Angular 1 digests should be run inside the ngZone to ensure
that async changes are detected.

We don't know how to fix #6385 without breaking change detection
at this stage. That issue is triggered by async operations, such as
`setTimeout`, being triggered inside scope watcher functions.

One could argue that watcher functions should be pure and not do
work such as triggering async operations. It is possible that the
original use case could be supported by moving the debounce
logic into the watch listener function, which is only called if the
watched value actually changes.

See #13812

PR Close #14039
2017-01-27 11:51:55 -06:00
Bowen Ni 665dde2e5c refactor(compiler): improve error messages in aot compiler (#14017)
Previously aot compiler prints stack traces when it fails to resolve.
New behavior: aot compiler outputs the error message.
Example: https://gist.github.com/bowenni/a7fe81d916e8cd4a06b0e133436f40fb

PR Close #14017
2017-01-27 11:49:38 -06:00
Peter Bacon Darwin b7763559cd build(aio): move doc-gen stuff from angular.io (#14097) 2017-01-26 23:46:59 -08:00
Peter Bacon Darwin 2dd9654004 docs(http): vanilla links do not need link tags (#14097) 2017-01-26 23:46:51 -08:00
Peter Bacon Darwin e35c25d2ce docs(router): remove invalid jsdoc tags (#14097)
The `@selector` tags are not valid.
Dgeni should be able to extract this information
from the directive annotation metadata.
2017-01-26 23:46:38 -08:00
Tobias Bosch 1e729d7ba2 feat(core): add query support to view engine
Part of #14013
closes #14084
2017-01-25 17:44:56 -08:00
Tobias Bosch fc8694ed11 refactor(core): view engine, refactor runtime data
Structure in a better way, in preparation for queries.
2017-01-25 17:44:42 -08:00
Victor Berchet 05b2b49711 fix(compiler): allow empty translations for attributes (#14085)
fixes #13897
2017-01-25 17:43:19 -08:00
Jason Aden 3ef73c2b19 feat(NgComponentOutlet): add NgModule support to NgComponentOutlet directive (#14088)
Allow NgComponentOutlet to dynamically load a module, then load a component from
that module. Useful for lazy loading code, then add the lazy loaded code to the
page using NgComponentOutlet.

Closes #14043
2017-01-25 17:41:08 -08:00
Alex Rickabaugh 28bdc5af47 chore(release): cut the 4.0.0-beta.5 release 2017-01-25 15:38:19 -08:00
Alex Rickabaugh d2859cdd71 style(compiler): run format 2017-01-25 13:17:18 -08:00
Matias Niemelä 4931a615bf docs(core): add docs for `AnimationStyles` and `AnimationKeyframe` (#14107) 2017-01-25 11:46:15 -08:00
Victor Berchet a733444d0e docs(compiler): add comment to warn about regexp changes (#14106)
ref #14082
2017-01-25 10:27:18 -08:00
Pete Bacon Darwin 6152eb24bc fix(upgrade/static): ensure upgraded injector is initialized early enough (#14065)
This change ensures that the upgraded AngularJS injector is initialized
before the application run blocks are executed.

Closes #13811
2017-01-24 14:48:03 -08:00
Victor Berchet b2f9d56577 fix(compiler): fix regexp to support firefox 31 (#14082)
fixes #14029
closes #13900
2017-01-24 14:47:51 -08:00
Victor Berchet 1c24271daf refactor(compiler): [i18n] integrate review feedback 2017-01-24 14:47:04 -08:00
Victor Berchet c3e5ddbe20 refactor(compiler): [i18n] move dedup and placeholder mapping to the `MessageBundle`
It makes implementing a `Serializer` simpler as implementations do not have to
care any more about message dedup and placeholder mapping.
2017-01-24 14:47:04 -08:00
Victor Berchet d02eab498f fix(compiler): [i18n] XMB/XTB placeholder names can contain only A-Z, 0-9, _n
There are restrictions on the character set that can be used for xmb and xtb
placeholder names.

However because changing the placeholder names would change the message IDs it
is not possible to add those restrictions to the names used internally. Then we
have to map internal name to public names when generating an xmb file and back
when translating using an xtb file.

Note for implementors of `Serializer`:
- When writing a file, the implementor should take care of converting the
internal names to public names while visiting the message nodes - this is
required because the original nodes are needed to compute the message ID.
- When reading a file, the implementor does not need to take care of the mapping
back to internal names as this is handled in the `I18nToHtmlVisitor` used by the
`TranslationBundle`.

fixes b/34339636
2017-01-24 14:47:04 -08:00
Dzmitry Shylovich 83361d811d fix(core): export animation classes required for Renderer impl (#14002)
Closes #14001
2017-01-24 10:22:47 -08:00
Matthew Hegarty 1f54040ef4 docs(common): fix a typo on the DatePipe API docs (#14060) 2017-01-24 10:21:59 -08:00
Tobias Bosch 65417374f1 feat(core): add pure expression support to view engine
Part of #14013
2017-01-24 10:10:31 -08:00
Tobias Bosch 0adb97bffb feat(core): add event support to view engine
Part of #14013
2017-01-24 10:10:31 -08:00
Karl Seamon e21e9c5fb7 feat(upgrade): Support ng-model in downgraded components (#10578) 2017-01-23 11:23:45 -08:00
Tobias Bosch d3a3a8e1fc fix(core): fix not declared variable in view engine (#14045)
In TypeScript, referring to `name` does not lead to an error
as `window` also has a property `name`.
2017-01-23 11:23:15 -08:00
Jonathan Adamski 0589f93e41 Fixed documentation reference to canActivate in canDeactivate (#14018)
Simple update to code sample which references canActivate: ['canDeactivateTeam'].
2017-01-20 14:19:23 -08:00
Tobias Bosch 2f87eb52fe feat(core): add initial view engine (#14014)
The new view engine allows our codegen to produce less code,
as it can interpret view definitions during runtime.

The view engine is not feature complete yet, but already
allows to implement a tree benchmark based on it.

Part of #14013
2017-01-20 13:10:57 -08:00
Alex Eagle b049217437 chore(docs): add missing comments (#14003)
This is a load-bearing change to avoid duplicate licenses in closure-compiled bundles.
See https://github.com/angular/tsickle/issues/332
2017-01-19 12:06:28 -08:00
Miško Hevery 4b854be29e chore(release): cut the 4.0.0-beta.4 release 2017-01-18 18:55:46 -06:00
Dzmitry Shylovich 1200cf25f4 fix(http): don't create a blob out of ArrayBuffer when type is application/octet-stream (#13992)
Closes #13973
2017-01-18 16:01:02 -08:00
Dzmitry Shylovich 635bf02b02 fix(router): enable loadChildren with function in aot (#13909)
Closes #11075
2017-01-18 15:56:34 -08:00
Tim Consolazio 2d7b3a86cc refactor(core): remove an unused import in application_ref (#13901) 2017-01-18 15:53:58 -08:00
Dzmitry Shylovich e8ea741039 fix(router): routerLinkActive should not throw when not initialized (#13273)
Fixes #13270

PR Close #13273
2017-01-17 18:38:45 -06:00
Dzmitry Shylovich 1a92e3d406 refactor(router): clean up RouterLinkActive (#13273)
PR Close #13273
2017-01-17 18:37:34 -06:00
Miško Hevery d169c2434e feat(core): Add type information to injector.get() (#13785)
- Introduce `InjectionToken<T>` which is a parameterized and type-safe
  version of `OpaqueToken`.

DEPRECATION:
- `OpaqueToken` is now deprecated, use `InjectionToken<T>` instead.
- `Injector.get(token: any, notFoundValue?: any): any` is now deprecated
  use the same method which is now overloaded as
  `Injector.get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T): T;`.

Migration
- Replace `OpaqueToken` with `InjectionToken<?>` and parameterize it.
- Migrate your code to only use `Type<?>` or `InjectionToken<?>` as
  injection tokens. Using other tokens will not be supported in the
  future.

BREAKING CHANGE:
- Because `injector.get()` is now parameterize it is possible that code
  which used to work no longer type checks. Example would be if one
  injects `Foo` but configures it as `{provide: Foo, useClass: MockFoo}`.
  The injection instance will be that of `MockFoo` but the type will be
  `Foo` instead of `any` as in the past. This means that it was possible
  to call a method on `MockFoo` in the past which now will fail type
  check. See this example:

```
class Foo {}
class MockFoo extends Foo {
  setupMock();
}

var PROVIDERS = [
  {provide: Foo, useClass: MockFoo}
];

...

function myTest(injector: Injector) {
  var foo = injector.get(Foo);
  // This line used to work since `foo` used to be `any` before this
  // change, it will now be `Foo`, and `Foo` does not have `setUpMock()`.
  // The fix is to downcast: `injector.get(Foo) as MockFoo`.
  foo.setUpMock();
}
```

PR Close #13785
2017-01-17 15:34:54 -06:00
Miško Hevery 6d1f1a43bb refactor(core): opaque_token.ts -> injection_token.ts (must include subsequent SHA) (#13785) 2017-01-17 15:34:53 -06:00
Martin Probst e19bf70b47 feat(security): allow calc and gradient functions. (#13943)
PR Close #13943

Also includes support for # color notation in function arguments (common
in gradient functions).
2017-01-17 15:34:53 -06:00
Peter Bacon Darwin d6382bfa0b fix(upgrade): detect async downgrade component changes (#13812)
This commit effectively reverts 7e0f02f96e
as it was an invalid fix for #6385, that created a more significant
bug, which was that changes were not always being detected.

Angular 1 digests should be run inside the ngZone to ensure
that async changes are detected.

We don't know how to fix #6385 without breaking change detection
at this stage. That issue is triggered by async operations, such as
`setTimeout`, being triggered inside scope watcher functions.

One could argue that watcher functions should be pure and not do
work such as triggering async operations. It is possible that the
original use case could be supported by moving the debounce
logic into the watch listener function, which is only called if the
watched value actually changes.

Closes #10660, #12318, #12034

PR Close #13812
2017-01-17 15:34:53 -06:00
Peter Bacon Darwin 4dea347101 test(upgrade): reorganise test layout (#13812) 2017-01-17 15:34:53 -06:00
Vikram Subramanian 5237b1c98c chore(compiler-cli): Move calculateEmitPath into CompilerHost (#13904)
This is so that it can be overriden in an environment specific CompilerHost(like within Google) to customize the output paths.

PR Close #13904
2017-01-13 13:52:35 -06:00
Marc Laval f364557629 fix(common): support numeric value as discrete cases for NgPlural (#13876)
PR Close #13876
2017-01-13 13:52:35 -06:00
Matias Niemelä c2aa981dd6 fix(animations): fix internal jscompiler issue and AOT quoting (#13798)
CL #143630929
PR Close #13798
2017-01-13 13:52:00 -06:00
José Nicodemos Maia Neto dc63cef10a docs(http): Spelling Fix #13867 2017-01-12 09:55:49 -08:00
Meligy aeed7373af fix(compiler-cli): avoid handling functions in loadChildren as lazy load routes paths
The change avoids the compiler CLI internal API from mismatching the following case as lazy loading

```
import { NonLazyLoadedModule } from './non-lazy-loaded/non-lazy-loaded.module';

export function getNonLazyLoadedModule() { return NonLazyLoadedModule; }

export const routes = [
{ path: '/some-path', loadChildren: getNonLazyLoadedModule }
];
```

The output of the check is later passed to `RouteDef.fromString()`, so, it makes sense to be only a string.

Fixes angular/angular-cli#3204
2017-01-10 14:31:45 -05:00
Pawel Kozlowski 2e3ac70e0a refactor(common): remove some facade usages 2017-01-10 14:31:30 -05:00
Victor Berchet 9aeb8c5357 refactor(test): `<template>`/`<ng-container>`/*-directives
- remove outer `<div>` in tests,
- use `<ng-container>` instead of `<template>` where possible,
- use *... instead of template (tag or attr) where possible.

Fixes #13816
2017-01-09 19:33:38 -05:00
Victor Berchet 424e6c4cb9 fix(i18n): translate attributes inside elements marked for translation
fixes #13796
fixes #13814
2017-01-09 19:33:03 -05:00
Victor Berchet 5cb2008e6c docs(NgPlural): fix API docs
Fixes #13786
2017-01-09 19:32:42 -05:00
Victor Berchet 78f42c7aa1 refactor(Compiler): misc cleanup 2017-01-09 19:32:01 -05:00
Julien Elbaz d4d3782d45 feat(Router): call resolver when upstream params change (#12942)
With this change the resolver is called when the parameter for the activated and any parent routes change.
ie, switching from `/teams/10/players/5` to `/teams/12/players/5` will now trigger any `PlayerResolver`.
2017-01-09 18:56:58 -05:00
Dzmitry Shylovich 46cb04d575 fix(router): throw an error when navigate to null/undefined path
Closes #10560

Fixes #13384
2017-01-09 18:56:47 -05:00
Joao Dias 8c7e93bebe fix(core): Add type information to differs
CHANGES:

- Remove unused `onDestroy` method on the `KeyValueDiffer` and
  `IterableDiffer`.

DEPRECATION:

- `CollectionChangeRecord` is renamed to `IterableChangeRecord`.
  `CollectionChangeRecord` is aliased to `IterableChangeRecord` and is
  marked as `@deprecated`. It will be removed in `v5.x.x`.
- Deprecate `DefaultIterableDiffer` as it is private class which
  was erroneously exposed.
- Deprecate `KeyValueDiffers#factories` as it is private field which
  was erroneously exposed.
- Deprecate `IterableDiffers#factories` as it is private field which
  was erroneously exposed.

BREAKING CHANGE:

- `IterableChangeRecord` is now an interface and parameterized on `<V>`.
  This should not be an issue unless your code does
  `new IterableChangeRecord` which it should not have a reason to do.
- `KeyValueChangeRecord` is now an interface and parameterized on `<V>`.
  This should not be an issue unless your code does
  `new IterableChangeRecord` which it should not have a reason to do.

Original PR #12570

Fixes #13382
2017-01-09 18:56:34 -05:00
Meligy 5d9cbd7d6f fix(compiler-cli): add support for more than 2 levels of nested lazy routes
This change adds Compiler CLI support for any level of nesting for lazy routes.

For example `{app-root}/lazy-loaded-module-1/lazy-loaded-module-2/lazy-loaded-module-3`

Where `lazy-loaded-module-3` is lazy loaded from `lazy-loaded-module-2`,
and `lazy-loaded-module-2` is lazy loaded from module `lazy-loaded-module-1`,
and `lazy-loaded-module-1` is lazy loaded from `AppModule`

Fixes angular/angular-cli#3663
2017-01-09 17:43:14 -05:00
Chuck Jazdzewski d061adc02d fix(compiler): avoid evaluating arguments to unknown decorators
Fixes #13605
2017-01-09 16:30:31 -05:00
Victor Berchet 6d29faefea fix(Router): fix checking for object intersection 2017-01-09 16:30:14 -05:00
Ryan Cavanaugh 99aa49ab6c feat(language-service): support TS2.2 plugin model 2017-01-09 15:00:40 -05:00
Victor Berchet e5c6bb4286 fix(Compiler): fix template binding parsing (`*directive="-..."`)
fixes #13800
2017-01-09 15:00:40 -05:00
Dzmitry Shylovich d9a22dae4f fix(router): RouterLink mirrors input `target` as attribute
Closes #13837
2017-01-09 15:00:40 -05:00
Matias Niemelä fb6c4582a1 chore(ngComponentOutlet): add missing semicolon 2017-01-09 11:54:25 -08:00
shlomiassaf 8578682dcf feat(NgComponentOutlet): add NgComponentOutlet directive
Add NgComponentOutlet directive that can be used to dynamically create
host views from a supplied component.

Closes #11168
Takes over PR #11235
2017-01-06 19:30:38 -05:00
Misko Hevery c0178de0e2 feat(NgTemplateOutlet): Make NgTemplateOutlet compatible with * syntax
BREAKING CHANGE:

- Deprecate `ngOutletContext`. Use `ngTemplateOutletContext` instead
2017-01-06 19:30:20 -05:00
Misko Hevery 31322e73b7 fix: correctly show error when karma fails to load 2017-01-06 19:30:09 -05:00
Matias Niemelä 9211a22039 feat(animations): support function types in transitions
Closes #13538
Closes #13537
2017-01-06 19:29:46 -05:00
Matias Niemelä 3f67ab074a feat(animations): expose the `triggerName` within the transition event
Closes #13600
2017-01-06 19:29:45 -05:00
Matias Niemelä 4bae4b3bb5 feat(animations): expose the `element` value within transition events 2017-01-06 19:29:45 -05:00
Igor Minar 1c85e99588 chore(tsc-wrapped): bump version number to 4.0.0-beta.2
This was done in order for us to be able to publish tsc-wrapped as @next tag on npm.

The next step is to change the build scripts to version and release @angular/tsc-wrapped
together with all the other packages. I'll create an issue/PR for this.
2017-01-05 17:53:10 -08:00
Chuck Jazdzewski 8063b0d9a2 fix(language-service): support TypeScript 2.1 (#13655)
@angular/language-service now supports using TypeScript 2.1 as the
the TypeScript host. TypeScript 2.1 is now also partially supported
in `ngc` but is not recommended as Tsickle does not yet support 2.1.
2017-01-05 11:34:42 -08:00
Matias Niemelä 21030e9a1c fix(core): animations no longer silently exits if the element is not apart of the DOM (#13763) 2017-01-05 11:33:40 -08:00
Matias Niemelä 889b48d85f fix(core): animations should blend in all previously transitioned styles into next animation if interrupted (#13148) 2017-01-05 11:32:52 -08:00
Victor Berchet 1bd04e95de refactor: remove unused imports 2017-01-05 11:18:34 -08:00
Victor Berchet f88cd2f22e fix(Common): allow null/undefined values for `NgForTrackBy`
Reverts a breaking change introduced in 2.4.1 by #13420
fixes #13641
2017-01-05 11:18:34 -08:00
Dzmitry Shylovich f822f9599c docs(common): add an example how to bind multiple classes based on a single parameter (#13779)
Closes #13778
2017-01-05 10:21:38 -08:00
Dzmitry Shylovich 9898d8f6d9 fix(forms): Validators.required properly validate arrays (#13362)
Closes #12274
2017-01-05 09:25:20 -08:00
Dzmitry Shylovich 2dd6280ab8 fix(common): do not override locale provided on bootstrap (#13654)
Closes #13607
2017-01-05 09:24:37 -08:00
Tobias Bosch 465516b905 refactor(core): remove backwards compatibility of `SimpleChange`
BREAKING CHANGE:
`SimnpleChange` now takes an additional argument that defines
whether this is the first change or not.
2017-01-03 13:05:05 -08:00
Tobias Bosch db49d422f2 refactor(compiler): generate less code for bindings to DOM elements
Detailed changes:
- remove `UNINITIALIZED`, initialize change detection fields with `undefined`.
  * we use `view.numberOfChecks === 0` now everywhere
    as indicator whether we are in the first change detection cycle
    (previously we used this only in a couple of places).
  * we keep the initialization itself as change detection get slower without it.
- remove passing around `throwOnChange` in various generated calls,
  and store it on the view as property instead.
- change generated code for bindings to DOM elements as follows:
  Before:
  ```
  var currVal_10 = self.context.bgColor;
  if (jit_checkBinding15(self.throwOnChange,self._expr_10,currVal_10)) {
    self.renderer.setElementStyle(self._el_0,'backgroundColor',((self.viewUtils.sanitizer.sanitize(jit_21,currVal_10) == null)? null: self.viewUtils.sanitizer.sanitize(jit_21,currVal_10).toString()));
    self._expr_10 = currVal_10;
  }
  var currVal_11 = jit_inlineInterpolate16(1,' ',self.context.data.value,' ');
  if (jit_checkBinding15(self.throwOnChange,self._expr_11,currVal_11)) {
    self.renderer.setText(self._text_1,currVal_11);
    self._expr_11 = currVal_11;
  }
  ```,
  After:
  ```
  var currVal_10 = self.context.bgColor;
  jit_checkRenderStyle14(self,self._el_0,'backgroundColor',null,self._expr_10,self._expr_10=currVal_10,false,jit_21);
  var currVal_11 = jit_inlineInterpolate15(1,' ',self.context.data.value,' ');
  jit_checkRenderText16(self,self._text_1,self._expr_11,self._expr_11=currVal_11,false);
  ```

Performance impact:
- None seen (checked against internal latency lab)

Part of #13651
2017-01-03 13:05:05 -08:00
Tobias Bosch 8ed92d75b0 refactor(benchmarks): make ftl benchmarks use their own version of `checkBinding` 2017-01-03 13:05:05 -08:00
Tobias Bosch 50e5cb15dd feat(benchmarks): add `detectChanges` test for ng2 tree benchmark 2017-01-03 13:05:05 -08:00
William KOZA c5c53f3666 fix(core): Remove reference to "Angular 2" in dev mode warning (#13751) 2017-01-03 10:03:58 -08:00
Jon Walsh bb0d23f82b Typo (#13698) 2016-12-29 09:41:21 -08:00
Emanuel Hein 1e6440e81b docs(Http): fix and extend samples for testing/MockBackend (#13689)
Fix samples for MockBackend and MockBackend.connections that were outdated. Also extend central sample for MockBackend to ease getting started.
2016-12-29 09:39:00 -08:00
Dzmitry Shylovich 6b02b80a03 fix(compiler): improve error message for undefined providers (#13546)
Closes #10835
2016-12-27 17:05:14 -08:00
Dzmitry Shylovich 2c0c86e3ce
fix(compiler): improve the error when template is not a string
Closes #8708
Closes #13377
2016-12-27 17:04:16 -08:00
Dzmitry Shylovich 5b4bea24de
refactor(compiler): clean up directive normalizer 2016-12-27 17:03:58 -08:00
Tobias Bosch 7690d02133 fix(compiler): don’t throw when using `ANALYZE_FOR_ENTRY_COMPONENTS` with user classes (#13679)
Fixed #13565
2016-12-27 16:58:52 -08:00
Tsuyoshi Ito b2ae7b607e docs(Core): fix API docs for ContentChild and ViewChildren (#13656)
Move the documentations of the ContentChild and ViewChildren decorators
so that they appear correctly on angular.io.

Closes #13625
2016-12-27 16:58:33 -08:00
Tobias Bosch 7c210645a3 fix(compiler): query `<template>` elements before their children. (#13677)
Fixes #13118
Closes #13167
2016-12-27 16:28:54 -08:00
Dzmitry Shylovich 07e0fce8fc fix(router): update route snapshot before emit new values (#13558)
Closes #12912
2016-12-27 15:57:22 -08:00
Victor Berchet 0ac8e102de
test(i18n): add extraction to integration specs
Closes #13648.
2016-12-27 15:32:54 -08:00
Victor Berchet e74d8aaf92
fix(i18n): parse ICU messages while normalizing templates
Fixes:
- Inject the i18n specific HtmlParser into the directive normalizer,
- Parse ICU messages while normalizing templates,
- Normalize (visit) the content of ICU messages.

🎄🎁🎅
2016-12-27 15:32:43 -08:00
Victor Berchet 881eb894bc fix(Compiler): allow "." in attribute selectors (#13653)
fixes #13645
2016-12-27 15:23:49 -08:00
Dzmitry Shylovich 0eca960494 fix(router): fix lazy loaded module with wildcard route (#13649)
Closes #12955
2016-12-27 15:22:57 -08:00
Victor Berchet eed83443b8 chore(tslint): update tslint to 4.x (#13603) 2016-12-27 14:55:58 -08:00
Georgios Kalpakas e5c4e5801f fix(upgrade): fix/improve support for lifecycle hooks (#13020)
With the exception of `$onChanges()`, all lifecycle hooks in ng1 are called on
the controller, regardless if it is the binding destination or not (i.e.
regardless of the value of `bindToController`).

This change makes `upgrade` mimic that behavior when calling lifecycle hooks.

Additionally, calling the `$onInit()` hook has been moved before calling the
linking functions, which also mimics the ng1 behavior.
2016-12-27 14:42:53 -08:00
Dzmitry Shylovich 69fa3bbc03 feat(router): add an extra argument to CanDeactivate interface (#13560)
Adds a `nextState` argument to access the future url from `CanDeactivate`.

BEFORE:

    canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean;

AFTER:

    canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean;

Closes #9853
2016-12-27 14:08:06 -08:00
Dzmitry Shylovich 445ed43b9a fix(compiler): throw an error for invalid provider (#13544)
Closes #8870
2016-12-27 14:02:28 -08:00
Dzmitry Shylovich 174334dec3 fix(router): routerLink support of null/undefined (#13380)
Closes #6971
2016-12-27 13:45:16 -08:00
Tobias Bosch 9c697030e6 feat(compiler): generate proper reexports in `.ngfactory.ts` files to not need transitive deps for compiling `.ngfactory.ts` files. (#13524)
Note: This checks the constructors of `@Injectable` classes more strictly.
E.g this will fail now as the constructor argument has no `@Inject` nor is
the type of the argument a DI token.

```
@Injectable()
class MyService {
  constructor(dep: string) {}
}
```

Last part of #12787
Closes #12787
2016-12-27 09:36:47 -08:00
Dzmitry Shylovich 697690349f fix(common): add link to trackBy docs (#13634) 2016-12-22 13:25:51 -08:00
Filipe Silva 0448e80704 docs(examples): fix example path (#13635) 2016-12-22 13:25:21 -08:00
Georgios Kalpakas e85232afd2 docs(ngIf): fix typos (#13630) 2016-12-22 12:36:47 -08:00
Chase e7ece6c8ce fixed minor typo (#13626) 2016-12-22 12:36:24 -08:00
Dzmitry Shylovich 67380d4b28 fix(testing): improve misleading error message when don't call compileComponents (#13543)
Closes #11301
2016-12-22 12:35:57 -08:00
Matias Niemelä 842f52e841 fix(animations): always recover from a failed animation step (#13604) 2016-12-21 14:14:45 -08:00
Victor Savkin eb2ceff4ba fix(router): should reset location if a navigation by location is successful (#13545)
Closes #13491
2016-12-21 12:47:58 -08:00
Matias Niemelä f49ab56160 fix(animations): always quote string map key values in AOT code (#13602) 2016-12-20 18:17:58 -08:00
Dzmitry Shylovich c0f750af4e fix(compiler): ignore @import in comments (#13368)
* refactor(compiler): clean up style url resolver
* fix(compiler): ignore @import in css comments

Closes #12196
2016-12-20 17:51:02 -08:00
Chuck Jazdzewski e69c1fb36c refactor(platform-browser): resolver merge conflict for tslint (#13601) 2016-12-20 17:49:25 -08:00
Georgios Kalpakas 9da4c259a5 feat(upgrade): support the `$doCheck()` lifecycle hook in `UpgradeComponent` (#13015) 2016-12-20 16:18:43 -08:00
Dzmitry Shylovich fcd116fdc0 fix(common): throw an error if trackBy is not a function (#13420)
* fix(common): throw an error if trackBy is not a function

Closes #13388

* refactor(platform-browser): disable no-console rule in DomAdapter
2016-12-20 16:18:24 -08:00
Dzmitry Shylovich 383adc9ad9 fix(core): improve error message when component factory cannot be found (#13541)
Closes #12678
2016-12-20 16:17:22 -08:00
crisbeto 171a9bdc85 feat: update to rxjs@5.0.1 and unpin the rxjs peerDeps via ^5.0.1 (#13572)
Now that rxjs is stable and the rxjs team follows semver, we can update and unpin the dependency safely.

From now on the Angular application/library developers are in charge of controlling the rxjs version as long as it's newer than 5.0.1.

closes #13561
closes #13478
closes #13572
2016-12-19 16:24:53 -08:00
Chuck Jazdzewski e49c7fae22 refactor(compiler-cli): support extracting the mesage bundle without writing a file (#13580) 2016-12-19 15:28:55 -08:00
Victor Berchet 6b65fc1286 feat(compiler-cli): private i18n API for the CLI (#13536)
Also change the Extractor API to align with the Codegen API (internal APIs)
2016-12-19 11:56:10 -08:00
Chuck Jazdzewski 0e3981afc1 fix(compiler-cli): produce metadata for .d.ts files without metadata (#13526)
Fixes #13307
Fixes #13473
Fixes #13521
2016-12-16 15:33:47 -08:00
Victor Berchet e78508507d fix(compiler): do not lex `}}` when interpolation is disabled (#13531)
* doc(compiler): fix the ICU expander API docs

* test(compiler): add lexer and parser specs

* fix(compiler): do not lex `}}` when interpolation is disabled

fix #13525
2016-12-16 15:33:16 -08:00
Brandon a23fa94ca8 fix(common): capitalize first letter of all words in TitleCasePipe (#13511) 2016-12-16 15:24:26 -08:00
Dzmitry Shylovich 4568d5ddac refactor(core): fix typo (#13515)
Closes #13512
2016-12-16 15:21:58 -08:00
Janne Vanhala c6e893953f fix(upgrade): fix `registerForNg1Tests` (#13522)
Fix an issue in `registerForNg1Tests`, where it passes a `null` as
`ng1Injector` to `_bootstrapDone`. This causes a "TypeError: Cannot
read property 'get' of null" to be thrown from `_bootstrapDone`.
2016-12-16 15:14:16 -08:00
Marc Laval 55dfa1b69d test(forms): refactor integration tests to improve speed (#13500) 2016-12-15 17:07:26 -08:00
Victor Berchet 0fe3cd9a4c fix(i18n): add a default example to xmb placeholders (#13507)
Otherwise the TC would not be able to load the message
2016-12-15 15:33:42 -08:00
Matias Niemelä 0c19898694 fix(animations): allow players to be destroyed before initialized (#13346)
Closes #13293
Closes #13346
2016-12-15 14:18:57 -08:00
Chuck Jazdzewski 5b6e8ea3ec refactor(compiler): format update (#13506) 2016-12-15 13:54:38 -08:00
Trotyl Yu 732f446ad2 docs(common): fix ngIf example (#13496) 2016-12-15 13:07:36 -08:00
Bowen Ni f0e092515c refactor(compiler): don't print stack trace on template parse errors (#13390) 2016-12-15 13:07:12 -08:00
Tobias Bosch 33910ddfc9 refactor(compiler): store metadata of top level symbols also in summaries (#13289)
This allows a build using summaries to not need .metadata.json files at all
any more.

Part of #12787
2016-12-15 09:12:40 -08:00
Victor Berchet 6cefccb314 build: bump angular to 4.0.0-beta.0 & tsc-wrapped to 0.5.0 2016-12-14 16:42:44 -08:00
Victor Berchet fa9e21e83c fix(compiler): fix merge error in compiler_host 2016-12-14 15:36:49 -08:00
Chuck Jazdzewski b6078f5887 fix(compiler): update to metadata version 3 (#13464)
This change retracts support for metadata version 2.

The collector used to produce version 2 metadata was incomplete
and can cause the AOT compiler to fail to resolve symbols or
produce other spurious errors.

All libraries compiled and published with 2.3.0 ngc will need
to be recompiled and updated with this change.
2016-12-14 15:28:51 -08:00
Victor Berchet c65b4fa9dc refactor: format & lint 2016-12-14 15:10:43 -08:00
Dzmitry Shylovich 169ed82900 feat(testing): add overrideTemplate method (#13372)
Closes #10685
2016-12-14 15:05:17 -08:00
Matias Niemelä fd8e15b15d chore(animations/aot): always export NoOpAnimationDriver (#13480) 2016-12-14 14:51:29 -08:00
Victor Berchet aa40366a92 fix(compiler): fix simplify a reference without a name
closes #13470
2016-12-14 14:33:10 -08:00
Victor Berchet 40d8d9c3e3 fix(tsc-wrapped): generate metadata for exports without module specifier
fixes #13327
2016-12-14 14:33:04 -08:00
Victor Berchet ee2ac025ef fix(compiler): propagate exports when upgrading metadata to v2 2016-12-14 14:33:04 -08:00
Alex Rickabaugh aa3769ba69 fix(compiler): resolver should merge host bindings and listeners (#13474)
fixes #13327
2016-12-14 14:31:57 -08:00
Victor Berchet d4ddb6004e refactor: format & lint 2016-12-14 13:05:04 -08:00
Peter Bacon Darwin 84400bcc86 docs(upgrade): fix UpgradeAdapter examples
closes #12675
2016-12-14 13:02:31 -08:00
Peter Bacon Darwin 42d9998cbb docs(upgrade/upgrade_adapter): fix up references to AngularJS and Angular 2 2016-12-14 13:02:27 -08:00
Eudes Petonnet-Vincent c18d2fe5e3 feat(upgrade): enable Angular 1 unit testing of upgrade module
- New method `UpgradeAdapter.registerForNg1Tests(modules)` declares the
  Angular 1 upgrade module and provides it to the `angular.mock.module()`
  helper.
  This prevents the need to bootstrap the entire hybrid for every test.

Closes #5462, #12675
2016-12-14 13:02:27 -08:00
Eudes Petonnet-Vincent d91a86aac6 fix(upgrade): fix downgrade content projection and injector inheritance
- Full support for content projection in downgraded Angular 2
  components. In particular, this enables multi-slot projection and
  other features on <ng-content>.
- Correctly wire up hierarchical injectors for downgraded Angular 2
  components: downgraded components inherit the injector of the first
  other downgraded Angular 2 component they find up the DOM tree.

Closes #6629, #7727, #8729, #9643, #9649, #12675
2016-12-14 13:02:27 -08:00
Peter Bacon Darwin d6e5e9283c refactor(upgrade/upgrade_adapter): use `Deferred` helper
Making Angular 1's `$compile` asynchronous by chaining injector promises
in linking functions can cause flickering views in applications.
2016-12-14 13:02:27 -08:00
Peter Bacon Darwin eab7e490c9 refactor(upgrade/util): remove unused `stringify()` method 2016-12-14 13:02:27 -08:00
Peter Bacon Darwin 3e90605db9 refactor(compiler/template_parser): export `createElementCssSelector`
This is needed in `ngUpgrade`.
2016-12-14 13:02:27 -08:00