Commit Graph

297 Commits

Author SHA1 Message Date
Shai Reznik 49162784a8 docs(core): fix API docs for `Injector.get` 2017-03-28 16:57:22 -07:00
Dzmitry Shylovich 0c36f2353d perf(router): don't create new serializer every time UrlTree.toString is called (#15565) 2017-03-28 16:17:48 -07:00
Matias Niemelä a580f8c61f fix(animations): make sure style calculations are not computed too early (#15540)
Closes #15507
2017-03-28 16:07:49 -07:00
Dzmitry Shylovich f368381d12 fix(router): should run CanActivate after CanDeactivate guards
Closes #14059
Closes #15467
2017-03-28 15:51:33 -07:00
Dzmitry Shylovich 7c2f795ea6 refactor(router): fix tests structure 2017-03-28 15:51:17 -07:00
Victor Berchet 93d48f1d89 fix(core): fix the key/value differ (#15539)
fixes #15457
2017-03-28 15:50:11 -07:00
Diego Barahona aa16ccda79 fix(core): check for undefined on normalizeDebugBindingValue (#15503)
DebugServices is parsing false atributes values incorrectly.
Parse5 expects a string value for attributes, but currently boolean is being sent.

Closes #15494
2017-03-28 13:33:07 -07:00
Chuck Jazdzewski 6269d28bb0 fix(language-service): improve performance of `updateModuleAnalysis()` (#15543) 2017-03-28 13:32:46 -07:00
Chuck Jazdzewski d438b88f19 fix(compiler): ignore errors when evaluating base classes (#15560)
Fixes #15536
2017-03-28 13:32:34 -07:00
Dzmitry Shylovich 8e03f65645 refactor(router): improve flatten fn
closes #15505
2017-03-28 09:39:20 -07:00
Dzmitry Shylovich 606b8fafb0 refactor(router): use object spread operator instead of merge fn 2017-03-28 09:38:58 -07:00
Dzmitry Shylovich b7fa5dec21 fix(core): improve error msg for invalid KeyValueDiffer.diff arg (#15489)
Closes #15402
2017-03-28 09:37:40 -07:00
Chuck Jazdzewski a5c972aa8b fix(language-service): be resilient to invalidate ordering (#15470)
Fixes #15466
2017-03-28 09:37:24 -07:00
JB Nizet d05aa70c6b docs(core): fix typo and example in InjectionToken doc (#15449)
The doc included an example that didn't use InjectionToken.
2017-03-28 09:37:08 -07:00
Chuck Jazdzewski 920bf373fe fix(language-service): guard access to `Symbol.members` (#15529)
Fixes #15528 

What is the current behavior?
The language service access TypeScript's Symbol.members without checking for null or undefined.
What is the new behavior?
The access is guarded.
2017-03-27 17:40:48 -07:00
Ward Bell 816b389759 docs: in doc comments, replace [aA]ngular2 with Angular (#15463) 2017-03-27 09:44:35 -07:00
Olivier Combe 53b89ec312 fix(compiler): allow single quotes into named interpolations (#15461)
Fixes #15318
2017-03-24 15:10:41 -07:00
Dzmitry Shylovich c17b912eb9 refactor: use object spread operator rather than merge (#15426) 2017-03-24 14:45:33 -07:00
Dzmitry Shylovich 8785b2bf6d fix(router): shouldn't execute CanLoad when a route has been loaded
Closes #14475
Closes #15438
2017-03-24 14:38:38 -07:00
Dzmitry Shylovich fb1be83a1b refactor(router): polishing 2017-03-24 14:38:23 -07:00
Mike ea848f74af docs: clarify querying all descendants (#15400)
Fixes #14417
Updated example to illustrate @ContentChildren default behavior (only query direct children), and how to query for nested elements/all descendants.
2017-03-24 14:36:55 -07:00
Marc Laval b8d5f87f96 feat(compiler): support ICU messages in XLIFF
Fixes #12636
Closes #15068
2017-03-24 14:35:28 -07:00
Marc Laval 95afaf495b test(compiler): refactor i18n integration test 2017-03-24 14:35:10 -07:00
Victor Berchet 1ba296644d release: cut the 4.0.0 release 2017-03-23 16:45:16 -07:00
Igor Minar b800a0c824 fix: prevent strictNullChecks support until #15432 is fixed (#15434) 2017-03-23 14:54:19 -07:00
Chuck Jazdzewski 0dda01e37c fix(compiler): correctly handle when `toString` is exported (#15430)
Fixes #15420
2017-03-23 13:38:01 -07:00
Tobias Bosch c8ab5cb0c5 fix(compiler): assume queries with no matches as static (#15429)
This has the side effect of allowing `@Input` and `@ContentChild`
on the same property if the query is static (see the bug description
for details).

Fixes #15417
2017-03-23 13:37:45 -07:00
Dzmitry Shylovich 92084f2b6a fix(platform-browser): setAttribute should work with xmlns namespace (#14874)
Closes #14865
2017-03-23 12:52:06 -07:00
Dzmitry Shylovich 08f2f08d74 fix(router): should pass new data to Observable when query params change (#15387)
Fixes #15290
2017-03-23 10:43:14 -07:00
Igor Minar ee03418b10 release: cut the 4.0.0-rc.6 release 2017-03-22 23:09:47 -07:00
Igor Minar da700d1842 docs: move markdown docs from root dir to docs/ and remove obsolete files (#15410) 2017-03-22 22:50:12 -07:00
Aliaksei Kuncevic de87c47dd9 docs: spelling errors 2017-03-22 21:28:24 -07:00
Aliaksei Kuncevic 1060805a1f docs: fix spelling 2017-03-22 21:28:24 -07:00
Rob Wormald 08d86751b9 fix(compiler): only log template deprecation warning once (#15364) 2017-03-22 21:26:53 -07:00
Josep Sayol 9319b5f329 docs(common): update ngFor docs to new `as` syntax (#15166) 2017-03-22 17:18:22 -07:00
Aliaksei Kuncevič edb2571a59 docs: spelling error (#15406) 2017-03-22 17:14:56 -07:00
JB Nizet 98cb974796 docs(router): fix typo in ParamMap api doc (#15397) 2017-03-22 17:14:11 -07:00
Victor Berchet ea49a95bd9 fix(upgrade): component injectors should not link the module injector tree (#15385) 2017-03-22 15:22:38 -07:00
Olivier Combe a50d79df47 fix(compiler-cli): adding missing format xliff for the extractor (#15386)
To generate XLF files with ng-xi18n we could use the format parameter "xlf" or "xlif". The real name is "xliff" not "xlif", so this probably was a typo. This PR adds "xliff" as can be expected
2017-03-22 15:12:02 -07:00
Aliaksei Kuncevič 941f194a83 docs: spelling errors (#15375) 2017-03-22 13:25:35 -07:00
Chuck Jazdzewski 90d2518d9a fix(compiler): look for flat module resources using declaration module path (#15367)
`ngc` would look for flat module resources relative to the flat module index.
`ngc` now looks for flat module resources relative to the `.d.ts` file that declarates
the component.

Fixes #15221

PR Close #15367
2017-03-21 19:05:03 -05:00
Kara Erickson 5efc86069f fix(forms): make composition event buffering configurable (#15256)
This commit fixes a regression where `ngModel` no longer syncs
letter by letter on Android devices, and instead syncs at the
end of every word. This broke when we introduced buffering of
IME events so IMEs like Pinyin keyboards or Katakana keyboards
wouldn't display composition strings. Unfortunately, iOS devices
and Android devices have opposite event behavior. Whereas iOS
devices fire composition events for IME keyboards only, Android
fires composition events for Latin-language keyboards. For
this reason, languages like English don't work as expected on
Android if we always buffer. So to support both platforms,
composition string buffering will only be turned on by default
for non-Android devices.

However, we have also added a `COMPOSITION_BUFFER_MODE` token
to make this configurable by the application. In some cases, apps
might might still want to receive intermediate values. For example,
some inputs begin searching based on Latin letters before a
character selection is made.

As a provider, this is fairly flexible. If you want to turn
composition buffering off, simply provide the token at the top
level:

```ts
providers: [
   {provide: COMPOSITION_BUFFER_MODE, useValue: false}
]
```

Or, if you want to change the mode  based on locale or platform,
you can use a factory:

```ts
import {shouldUseBuffering} from 'my/lib';

....
providers: [
   {provide: COMPOSITION_BUFFER_MODE, useFactory: shouldUseBuffering}
]
```

Closes #15079.

PR Close #15256
2017-03-21 16:47:18 -05:00
Victor Berchet bac265fdc2 refactor(core): misc cleanup (#15366)
PR Close #15366
2017-03-21 16:46:51 -05:00
Tobias Bosch 64beae9527 fix(core): mark components for check when host events trigger. (#15359)
Fixes #15352

PR Close #15359
2017-03-21 14:27:01 -05:00
Alex Rickabaugh 15a082c74e fix(platform-server): throw a better error message for relative URLs (#15357)
Unlike in the browser, on the server there is no concept of a document origin.
Thus, it is illegal to make requests for relative URLs against Http on platform-server.

Currently this fails with a vague error:

Error: Uncaught (in promise): Error at resolvePromise

This change adds explicit validation and a friendlier error message:

Error: URLs requested via Http on the server must be absolute. URL: /testing

Another option considered was to track the concept of an origin for the platform
and automatically prepend it to relative URLs. This would cause automatic "local
RPCs" to be made, though, which would be an unexpected and undesirable default
behavior.

Fixes #15349

PR Close #15357
2017-03-21 14:26:51 -05:00
Matias Niemelä fbccd5cd38 fix(animations): ensure empty animate() steps work at the end of a sequence (#15328)
Closes #15310
Closes #15328

PR Close #15328
2017-03-21 14:26:43 -05:00
Tobias Bosch 1e8b132ade refactor(compiler): only produce `log` expressions for elements / text (#15350)
This change reduces the amount of generated code by only adding `log`
calls for elements and text nodes.

We need the `log` calls to allow users to jump to the right place
in the template via source maps. However, we only need it for element
and text nodes, but not for directives, queries, … as for them we 
first locate the corresponding element or text node.

Related to #15239

PR Close #15350
2017-03-21 14:26:30 -05:00
Tobias Bosch 431eb309f3 fix(core): provide `NgModuleRef` in `ViewContainerRef.createComponent`. (#15350)
This is needed to support the corner cases:
- usage of a `ComponentFactory` that was created on the fly via `Compiler`
- overwriting of the `NgModuleRef` that is associated to a
  `ComponentFactory` by the `ComponentFactoryResolver` from
  which it was read.

Fixes #15241
2017-03-21 14:26:26 -05:00
Dzmitry Shylovich 8e6995c91e fix(core): stringify shouldn't throw when toString returns null/undefined (#14975)
Fixes #14948

PR Close #14975
2017-03-21 12:20:44 -05:00
Georgios Kalpakas 0759911431 docs(compiler-cli): mention that `.ngsummary.json` files should be gitignore'd (#15047)
PR Close #15047
2017-03-21 12:20:38 -05:00
Olivier Combe 1d7693c1e1 fix(compiler): use attribute id to merge translations (#15302)
We extracted ids from i18n attributes but forgot to use them when merging the translations, resulting in an error about missing translations even when they were correctly defined.

Fixes #15234

PR Close #15302
2017-03-21 12:20:31 -05:00
Chuck Jazdzewski 16e0423085 revert: feat(compiler-cli): support metadata file aliases (#15331)
This reverts commit 0ab49d4cec.

PR Close #15331
2017-03-21 12:20:14 -05:00
Stanimira Vlaeva 2489e4ba1b fix(animations): correct the main entry path in package.json (#15300)
PR Close #15300
2017-03-20 22:36:37 -05:00
Matias Niemelä 94da80148e fix(animations): stringify boolean values as `1` and `0` (#15311)
Closes #15247
Closes #15311

PR Close #15311
2017-03-20 22:36:29 -05:00
Tobias Bosch 764e90f9bb fix(compiler): don’t call `check` if we don’t need to (#15322)
If a directive has not bindings nor has a `ngDoCheck` / `ngOnInit`
lifecycle hook, don’t generate a `check` call.

This does not have an impact on the behavior, but produces
less code.

PR Close #15322
2017-03-20 22:36:20 -05:00
Matias Niemelä 9bf2fb4a74 fix(animations): ensure enter/leave cancellations work (#15323)
Closes #15315
Closes #15323

PR Close #15323
2017-03-20 22:36:11 -05:00
Alex Rickabaugh de3d2eeeba fix(platform-server): interpret Native view encapsulation as Emulated on the server (#15155)
PR Close #15155
2017-03-20 17:14:09 -05:00
Miško Hevery 61135bc842 fix: remove left over debugger statement (#15309)
PR Close #15309
2017-03-20 17:13:44 -05:00
Miško Hevery fa36ffda14 Revert "fix(compiler): shouldn't throw when Symbol is used as DI token (#13701)" (#15319)
This reverts commit 8b5c6b2732.

This feature is not compatible with the `Injector.get` which now only 
takes `Type` or `InjectableToken`. `Symbol` is not a valid type.

Closes #15183

PR Close #15319
2017-03-20 17:13:37 -05:00
Victor Berchet d3eda7a5b5 feat(router): add `ParamMap.keys` to get a list of parameters 2017-03-20 09:19:32 -07:00
Victor Berchet a755b715ed feat(router): introduce `ParamMap` to access parameters
The Router use the type `Params` for all of:
- position parameters,
- matrix parameters,
- query parameters.

`Params` is defined as follow `type Params = {[key: string]: any}`

Because parameters can either have single or multiple values, the type should
actually be `type Params = {[key: string]: string | string[]}`.

The client code often assumes that parameters have single values, as in the
following exemple:

```
class MyComponent {
sessionId: Observable<string>;

constructor(private route: ActivatedRoute) {}

ngOnInit() {
    this.sessionId = this.route
      .queryParams
      .map(params => params['session_id'] || 'None');
}
}

```

The problem here is that `params['session_id']` could be `string` or `string[]`
but the error is not caught at build time because of the `any` type.

Fixing the type as describe above would break the build because `sessionId`
would becomes an `Observable<string | string[]>`.

However the client code knows if it expects a single or multiple values. By
using the new `ParamMap` interface the user code can decide when it needs a
single value (calling `ParamMap.get(): string`) or multiple values (calling
`ParamMap.getAll(): string[]`).

The above exemple should be rewritten as:

```
class MyComponent {
sessionId: Observable<string>;

constructor(private route: ActivatedRoute) {}

ngOnInit() {
    this.sessionId = this.route
      .queryParamMap
      .map(paramMap => paramMap.get('session_id') || 'None');
}
}

```

Added APIs:
- `interface ParamMap`,
- `ActivatedRoute.paramMap: ParamMap`,
- `ActivatedRoute.queryParamMap: ParamMap`,
- `ActivatedRouteSnapshot.paramMap: ParamMap`,
- `ActivatedRouteSnapshot.queryParamMap: ParamMap`,
- `UrlSegment.parameterMap: ParamMap`
2017-03-20 09:19:32 -07:00
Victor Berchet a9d5de0e56 refactor(router): misc minor updates 2017-03-20 09:19:32 -07:00
Filipe Silva f634c62cb3 test: add systemjs+umd integration test (#14196)
This test ensures the `__esModule` is set on UMD bundles, thus making them compatible with SystemJS@^0.22.3.

Followup from https://github.com/frankwallis/plugin-typescript/issues/185.

PR Close #14196
2017-03-19 12:23:07 -05:00
Tobias Bosch f8c075ae27 fix(core): don’t create a comment for components with empty template. (#15260)
Fixes #15143

PR Close #15260
2017-03-19 12:22:26 -05:00
Matias Niemelä aeb99645bb test(animations): test various combinations of animations with host bindings (#15251)
PR Close #15251
2017-03-19 12:21:54 -05:00
Tobias Bosch 0d3e314df0 fix(core): trigger host animations for elements that are removed. (#15251)
Fixes #14813
Fixes #15193
2017-03-19 12:21:42 -05:00
Tobias Bosch 28ce68a13d refactor(core): view engine - change `BindingType` to `BindingFlags` (#15251) 2017-03-19 12:21:37 -05:00
Matias Niemelä 80075afe8a fix(animations): only process element nodes through the animation engine (#15268)
Closes #15267
Closes #15268

PR Close #15268
2017-03-19 10:50:07 -05:00
Tobias Bosch 0c43535ccc fix(core): only apply `WrappedValue` to the binding of the pipe (#15257)
Previously, a pipe that returned a `WrappedValue` would force the change
of the next bound property, independent of the binding in which the pipe
was used.

Now only the binding in which the `WrappedValue` is used will be assumed
as changed.

Fixes #15116

PR Close #15257
2017-03-17 17:38:36 -05:00
Jason Aden 49829b4a4d build: add package names to secondary endpoint package.json files (#15253)
Fixes #14736

PR Close #15253
2017-03-17 16:52:55 -05:00
Vikram Subramanian 5c5c2ae405 fix(platform-server): setup NoopAnimationsModule in ServerModule by default (#15131)
This is so that server side rendering does not throw an exception when it encounters animations on the server side and does not need the user to explicitly setup NoopAnimationsModule in their app server module.

Fixes #15098, #14784.

PR Close #15131
2017-03-17 16:21:51 -05:00
Matias Niemelä a6fb78ee3c fix(animations): make sure non-transitioned leave operations cancel existing animations (#15254)
Closes #15213

PR Close #15254
2017-03-17 15:35:11 -05:00
Matias Niemelä f92591054b fix(animations): make sure easing values work with web-animations (#15195)
Closes #15115
Closes #15195

PR Close #15195
2017-03-17 13:53:19 -05:00
Tobias Bosch 2a0e55ffb5 fix(core): allow tree shaking of component factories and styles (#15214)
Closure compiler is very sensitive to top level function calls.
This commit makes the function calls `createComponentFactory`
and `createRendererTypeV2` logic-less.

Fixes #15181

PR Close #15214
2017-03-17 13:52:57 -05:00
Tobias Bosch 9429032da1 feat(upgrade): use `ComponentFactory.inputs/outputs/ngContentSelectors` (#15214)
DEPRECATION:
- the arguments `inputs` / `outputs` / `ngContentSelectors` of `downgradeComponent`
  are no longer used as Angular calculates these automatically now.
- Compiler.getNgContentSelectors is deprecated. Use
  ComponentFactory.ngContentSelectors instead.
2017-03-17 13:52:50 -05:00
Tobias Bosch 791534f2f4 feat(core): expose `inputs`, `outputs` and `ngContentSelectors` on `ComponentFactory`. (#15214)
E.g. for a component like this:
```
@Component({
  template: ‘<ng-content select=“child”></ng-content>’
})
class MyComp {
  @Input(‘aInputName’)
  aInputProp: string;

  @Output(‘aEventName’)
  aOuputProp: EventEmitter<any>;
}
```

the `ComponentFactory` will now contain the following:
- `inputs = {aInputProp: ‘aInputName’}`
- `outputs = {aOutputProp: ‘aOutputName’}`
- `ngContentSelectors = [‘child’]`
2017-03-17 13:52:41 -05:00
Tobias Bosch 604546c287 refactor(upgrade): don’t rely on compiler internals (#15214)
Uses `Element.matches` to match selectors, instead
of copying the code from our compiler.
2017-03-17 13:52:34 -05:00
Matias Niemelä c66437fc13 fix(animations): only treat view removals as `void` state transitions (#15245)
Closes #15223

PR Close #15245
2017-03-17 13:48:25 -05:00
Tobias Bosch 8415910375 fix(compiler): add an empty content for source file of non mapped code. (#15246)
Before this when using ngc, tools tried to load `ng://…<component>.ts`
if `…<component>.ts` was the source file of a template.

PR Close #15246
2017-03-17 13:48:09 -05:00
Dzmitry Shylovich 5486e5417b feat(forms): allow to compile forms in strictNullChecks mode (#14679)
Closes #14667

PR Close #14679
2017-03-17 13:47:12 -05:00
Chuck Jazdzewski 52bed7f9b3 release: cut the 4.0.0-rc.5 release 2017-03-17 10:16:53 -07:00
Chuck Jazdzewski 7fb45283df fix(compiler-cli): update the tsc-wrapped dependency version (#15226) 2017-03-17 09:41:28 -07:00
Chuck Jazdzewski a52184bdda fix(core): update peer dep on zone.js to ^0.8.4 (#15209) 2017-03-16 20:10:53 -07:00
Jason Aden 410aa33005 build: fix paths to typings files so tsickle resolves imports correctly
Fixes #15080
2017-03-16 17:34:29 -07:00
Chuck Jazdzewski 0ab49d4cec feat(compiler-cli): support metadata file aliases 2017-03-16 17:34:29 -07:00
Tobias Bosch 994089d36b fix(compiler): always use `ng://` prefix for sourcemap urls (#15218)
Fixes:
- In G3, filePaths don’t start with a `/` and therefore became relative.
- Always using the `ng://` prefix groups angular resources in the same
  way for AOT and JIT.
2017-03-16 17:33:17 -07:00
Miško Hevery 77fd91d615 fix(core): ErrorHandler should not rethrow an error by default (#15077) (#15208)
ErrorHandler can not throw errors because it will unsubscribe itself from
the error stream.

Zones captures errors and feed it into NgZone, which than has a Rx Observable
to feed it into ErrorHandler. If the ErroHandler throws, then Rx will teardown
the observable which in essence causes the ErrorHandler to be removed from the
error handling. This implies that the ErrorHandler can never throw errors.

Closes #14949
Closes #15182
Closes #14316
2017-03-16 12:58:41 -07:00
Tobias Bosch 492153a986 fix(compiler): make sourcemaps work in AOT mode
Inlcuded fixes:
- include preamble in generated source map
- always add a mapping for line/col 0 so that the
  generated sourcemap is not sparse
- use a uniue sourceUrl for inline templates even
  in the AOT case
2017-03-16 12:56:56 -07:00
Victor Berchet a4076c70cc fix(platform-browser): prevent clobbered elements from freezing the browser
see
4f69d38f09
2017-03-16 10:16:39 -07:00
Victor Berchet 52bbc9baf4 refactor(platform-browser): cleanup HtmlSanitizer specs 2017-03-16 10:16:39 -07:00
Kara 26d4ce29e8 fix(forms): ensure observable validators are properly canceled (#15132)
Observable subscriptions from previous validation runs should be canceled
before a new subscription is created for the next validation run.
Currently the subscription that sets the errors is canceled properly,
but the source observable created by the validator is not. While this
does not affect validation status or error setting, the source
observables will incorrectly continue through the pipeline until they
complete. This change ensures that the whole stream is canceled.

AsyncValidatorFn previously had an "any" return type, but now it more
explicitly requires a Promise or Observable return type. We don't
anticipate this causing problems given that any other return type
would have caused a runtime error already.
2017-03-16 10:15:17 -07:00
Jason Aden 923d0c56e7 fix: correct UMD resolutions for platform-browser_animations (#15190)
Fixes #15114
2017-03-15 17:14:20 -07:00
Alex Rickabaugh 013d806b79 fix(platform-server): handle styles with extra ':'s correctly (#15189)
Previously, style values were parsed with a regex that split on /:+/.

This causes errors for CSS such as

div {
  background-url: url(http://server.com/img.png);
}

since the regex would split the background-url line into 3 values instead of 2.

Now, the : character is detected with indexOf, avoiding this error.

A test was added to verify the behavior is correct.
2017-03-15 17:13:31 -07:00
Dzmitry Shylovich 6e98757665 fix(core): use presence of .subscribe to detect observables rather then Symbol.observable (#15171)
Fixes #14298
Fixes #14473
Fixes #14926
2017-03-15 17:13:03 -07:00
Miško Hevery 313158132d Revert "fix(core): ErrorHandler should not rethrow an error by default (#15077)"
This reverts commit 6559425b07.
2017-03-15 16:29:24 -07:00
Matias Niemelä 62d5543b01 fix(animations): make sure easing values are applied to an empty animate() step (#15174)
Closes #15115
Closes #15174
2017-03-15 15:31:06 -07:00
Victor Berchet f1b33ab7b1 fix(http): Make ResponseOptionsArgs an interface (#14607) (#14623)
closes #13708
2017-03-15 15:28:52 -07:00
Victor Berchet 029d0f25e5 fix(router): fix query parameters with multiple values (#15129)
fixes #14796
2017-03-15 15:27:19 -07:00
Matias Niemelä 3f38c6fdcd fix(animations): always fire callbacks even for noop animations (#15170)
Closes #15170
2017-03-15 13:41:00 -07:00
Chuck Jazdzewski 795638e18b ci: remove unused import from integration test (#15175) 2017-03-15 13:39:00 -07:00
Chuck Jazdzewski 322bf7a0d5 Revert "refactor(upgrade): don’t rely on compiler internals"
This reverts commit 8e2c8b3e4d.
2017-03-15 13:23:31 -07:00
Chuck Jazdzewski cd981499f9 Revert "feat(core): expose `inputs`, `outputs` and `ngContentSelectors` on `ComponentFactory`."
This reverts commit 1171f91a80.
2017-03-15 13:23:10 -07:00
Chuck Jazdzewski c439742a54 Revert "feat(upgrade): use `ComponentFactory.inputs/outputs/ngContentSelectors`"
This reverts commit a3e32fb7e1.
2017-03-15 13:22:54 -07:00
Tobias Bosch a3e32fb7e1 feat(upgrade): use `ComponentFactory.inputs/outputs/ngContentSelectors`
DEPRECATION:
- the arguments `inputs` / `outputs` / `ngContentSelectors` of `downgradeComponent`
  are no longer used as Angular calculates these automatically now.
- Compiler.getNgContentSelectors is deprecated. Use
  ComponentFactory.ngContentSelectors instead.
2017-03-15 11:42:12 -07:00
Tobias Bosch 1171f91a80 feat(core): expose `inputs`, `outputs` and `ngContentSelectors` on `ComponentFactory`.
E.g. for a component like this:
```
@Component({
  template: ‘<ng-content select=“child”></ng-content>’
})
class MyComp {
  @Input(‘aInputName’)
  aInputProp: string;

  @Output(‘aEventName’)
  aOuputProp: EventEmitter<any>;
}
```

the `ComponentFactory` will now contain the following:
- `inputs = {aInputProp: ‘aInputName’}`
- `outputs = {aOutputProp: ‘aOutputName’}`
- `ngContentSelectors = [‘child’]`
2017-03-15 11:42:12 -07:00
Tobias Bosch 8e2c8b3e4d refactor(upgrade): don’t rely on compiler internals
Uses `Element.matches` to match selectors, instead
of copying the code from our compiler.
2017-03-15 11:42:12 -07:00
Chuck Jazdzewski b00fe20afd fix(compiler): support interface types in injectable constuctors (#14894)
Fixes #12631
2017-03-15 09:24:56 -07:00
Matias Niemelä 36ce0afff6 fix(animations): support multiple state names per state() call (#15147)
Closes #14732
Closes #15147
2017-03-15 09:24:09 -07:00
vikerman 4f7d62adac fix(platform-server): fix an exception when HostListener('window:scroll') is used on the server (#15019) 2017-03-14 20:48:01 -07:00
Miško Hevery c10c060d20 feat(common): support `as` syntax in template/* bindings (#15025)
* feat(common): support `as` syntax in template/* bindings

Closes #15020

Showing the new and the equivalent old syntax.
- `*ngIf="exp as var1”`
   => `*ngIf="exp; let var1 = ngIf”`
- `*ngFor="var item of itemsStream |async as items”`
   => `*ngFor="var item of itemsStream |async; let items = ngForOf”`

* feat(common): convert ngIf to use `*ngIf="exp as local“` syntax

* feat(common): convert ngForOf to use `*ngFor=“let i of exp as local“` syntax

* feat(common): expose NgForOfContext and NgIfContext
2017-03-14 20:46:29 -07:00
Tobias Bosch 5c34066058 fix(compiler): only warn for `@Injectable` classes with invalid args.
In v2.x, users had to annotate classes that they intended to use as tokens with `@Injectable`. This is no longer required in v4.x for tokens,
and we now require the constructor parameters of classes annotated
with `@Injectable` to be statically analyzable by ngc.

This commit reduces the error into a warning
if the constructor parameters do not meet this condition.

DEPRECATION:
- Classes annotated with `@Injectable` but whose constructor’s parameter types
  are not statically analyzable by ngc will produce a warning.

Closes #15003
2017-03-14 19:52:53 -07:00
Tobias Bosch 50ab06e29d fix(compiler): generated code should pass `noUnusedLocals` check
Closes #14797
2017-03-14 19:52:53 -07:00
Tobias Bosch 06fc42bc44 fix(core): don’t throw if queries change during change detection.
Throwing on query changes would be a breaking change compared to v2.
Also discovers a bug with querying manually projected content, see #15117.

Related to #14748
Closes #14925
2017-03-14 19:52:53 -07:00
Victor Berchet 959a03a61f fix(compiler): fix utf8encode, move to sharted utils, add tests (#15076) 2017-03-14 17:13:39 -07:00
Victor Berchet 3b1956bbf2 fix(compiler): warning prints "WARNING" instead of "ERROR" (#15125) 2017-03-14 17:12:44 -07:00
Bowen Ni 3c15916e17 fix(compiler): Improve error message for missing annotations (#14724)
Currently, it says:
Unexpected value 'FuzzyTimePipe in
javascript/angular2/example/search/fuzzy_time.ts' declared by the module
'SearchModule in javascript/angular2/example/search/search_module.ts'

The new error message also suggests: 'Please add a @Pipe/@Directive/@Component annotation.'
2017-03-14 17:12:18 -07:00
vikerman ff60c041f6 test(platform-server): add initial e2e tests for platform-server (#15061) 2017-03-14 17:11:39 -07:00
Victor Berchet 13686bb518 fix: element injector vs module injector (#15044)
fixes #12869
fixes #12889
fixes #13885
fixes #13870

Before this change there was a single injector tree.
Now we have 2 injector trees, one for the modules and one for the components.
This fixes lazy loading modules.

See the design docs for details:
https://docs.google.com/document/d/1OEUIwc-s69l1o97K0wBd_-Lth5BBxir1KuCRWklTlI4

BREAKING CHANGES

`ComponentFactory.create()` takes an extra optional `NgModuleRef` parameter.
No change should be required in user code as the correct module will be used
when none is provided

DEPRECATIONS

The following methods were used internally and are no more required:
- `RouterOutlet.locationFactoryResolver`
- `RouterOutlet.locationInjector`
2017-03-14 16:26:17 -07:00
vikerman f093501501 fix(platform-server): support svg elements with namespaced attributes (#15101) 2017-03-14 15:40:55 -07:00
Jason Jean 80649ea03c fix(platform-server): correctly implement get href in parse5 adapter (#15022) 2017-03-14 15:38:24 -07:00
Kara 778f7d6f33 fix(forms): remove equalsTo validator (#15050)
This API was introduced only in a beta release, and is being removed because we found it to be incorrect prior to launch. For more information about why this is being removed, see https://github.com/angular/angular/pull/15050.
2017-03-14 15:37:51 -07:00
Tobias Bosch 2c5a671341 fix: don't instantiate providers with ngOnDestroy eagerly. (#15070)
BREAKING CHANGE:

Perviously, any provider that had an ngOnDestroy lifecycle hook would be created eagerly.

Now, only classes that are annotated with @Component, @Directive, @Pipe, @NgModule are eager. Providers only become eager if they are either directly or transitively injected into one of the above.

This also makes all `useValue` providers eager, which
should have no observable impact other than code size.

EXPECTED IMPACT:
Making providers eager was an incorrect behavior and never documented.
Also, providers that are used by a directive / pipe / ngModule stay eager.
So the impact should be rather small.

Fixes #14552
2017-03-14 14:32:26 -07:00
Matias Niemelä 0aad270267 refactor(platform-browser): move platform-browser/animations to animations/browser (#15130)
Closes: #15130
2017-03-14 11:55:49 -07:00
Tobias Bosch cdc882bd36 feat: introduce source maps for templates (#15011)
The main use case for the generated source maps is to give
errors a meaningful context in terms of the original source
that the user wrote.

Related changes that are included in this commit:

* renamed virtual folders used for jit:
  * ng://<module type>/module.ngfactory.js
  * ng://<module type>/<comp type>.ngfactory.js
  * ng://<module type>/<comp type>.html (for inline templates)
* error logging:
  * all errors that happen in templates are logged
    from the place of the nearest element.
  * instead of logging error messages and stacks separately,
    we log the actual error. This is needed so that browsers apply
    source maps to the stack correctly.
  * error type and error is logged as one log entry.

Note that long-stack-trace zone has a bug that 
disables source maps for stack traces,
see https://github.com/angular/zone.js/issues/661.

BREAKING CHANGE:

- DebugNode.source no more returns the source location of a node.  

Closes 14013
2017-03-14 09:16:15 -07:00
Pete Bacon Darwin 914797a8ff feat(upgrade): support multi-slot projection in upgrade/static (#14282)
Closes #14261
2017-03-13 17:34:53 -07:00
Chuck Jazdzewski e6c81d2a42 Revert "refactor(platform-browser): move platform-browser/animations to animations/browser (#15043)"
This reverts commit 195b863ea4.
2017-03-13 15:46:44 -07:00
Chuck Jazdzewski 498a95148b Revert "build(animations): adjust animations/browser source to new standard for automatic build (#15043)"
This reverts commit 21a18d6ceb.
2017-03-13 15:46:07 -07:00
Jason Aden 21a18d6ceb build(animations): adjust animations/browser source to new standard for automatic build (#15043) 2017-03-13 14:39:42 -07:00
Matias Niemelä 195b863ea4 refactor(platform-browser): move platform-browser/animations to animations/browser (#15043) 2017-03-13 14:39:19 -07:00
Jason Jean 018e5c979b fix(platform-server): fix get/set title in parse5 adapter (#14965) 2017-03-13 13:22:03 -07:00
Dzmitry Shylovich 6559425b07 fix(core): ErrorHandler should not rethrow an error by default (#15077) 2017-03-13 11:27:01 -07:00
Tobias Bosch df914ef4bf fix(core): don’t recreate `TemplateRef` when used as a reference. (#15066)
This was a regression introduced in v4 rc.0.

Fixes #14873
2017-03-13 10:44:12 -07:00
Tobias Bosch ff71eff157 refactor(core): use flags in `Renderer2.setStyle` instead of booleans (#15045)
BREAKING CHANGE: (since v4 rc.1)
- `Renderer2.setStyle` no longer takes booleans but rather a
  bit mask of flags.
2017-03-13 09:45:04 -07:00
Tobias Bosch 6c8638cf01 feat(core): allow to provide multiple default testing modules (#15054)
This can be used to e.g. add the NoopAnimationsModule by default:

```
TestBed.initTestEnvironment([
  BrowserDynamicTestingModule,
  NoopAnimationsModule
], platformBrowserDynamicTesting());
```
2017-03-10 16:55:32 -08:00
Dzmitry Shylovich 8b5c6b2732 fix(compiler): shouldn't throw when Symbol is used as DI token (#13701)
Closes #13314
2017-03-10 15:26:37 -08:00
Chuck Jazdzewski 601494734c Revert "fix(core): ErrorHandler should not rethrow an error by default (#13534)"
This reverts commit 1aebea52e1.
2017-03-10 15:05:48 -08:00
Dzmitry Shylovich 1aebea52e1 fix(core): ErrorHandler should not rethrow an error by default (#13534)
Closes #14949
Closes #13159
Closes #8993
2017-03-10 14:44:14 -08:00
Dzmitry Shylovich 5f9fb911f7 fix(compiler): improve error msg for unexpected closing tags (#14747)
Closes #6652
2017-03-10 13:05:17 -08:00
Jason Aden bebedfed24 build: build modules and examples for karma 2017-03-08 17:35:20 -08:00
Jason Aden 2b44854885 build: fix paths for examples tests 2017-03-08 16:29:28 -08:00
Jason Aden b74ab83d2c refactor: update paths from modules/@angular to packages 2017-03-08 16:29:28 -08:00
Jason Aden da8ea350b2 refactor: More generic build.sh file 2017-03-08 16:29:28 -08:00
Jason Aden 58dd4673cd refactor: remove babel config files 2017-03-08 16:29:28 -08:00
Jason Aden 72563b61fb build: fix rollup config file paths 2017-03-08 16:29:28 -08:00
Jason Aden 5aed1e36b8 refactor: move secondary entry point rollup configs. 2017-03-08 16:29:28 -08:00
Jason Aden 8573e36574 build: fix file paths after moving modules/@angular/* to packages/* 2017-03-08 16:29:28 -08:00
Jason Aden 3e51a19983 refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00