Commit Graph

77 Commits

Author SHA1 Message Date
Tobias Bosch e263e19a2a fix(core): don’t stop change detection because of errors
- prevents unsubscribing from the zone on error
- prevents unsubscribing from directive `EventEmitter`s on error
- prevents detaching views in dev mode if there on error
- ensures that `ngOnInit` is only called 1x (also in prod mode)

Fixes #9531
Fixes #2413
Fixes #15925
2017-05-01 18:56:25 -04:00
Tobias Bosch a4de214e2b fix(core): don’t set `ng-version` for dynamically created components (#16394)
Angular uses the `ng-version` attribute to indicate which elements
were used to bootstrap an application. However, after 4.0 we also
added this attribute for all dynamically created components.

Fixes #15880

PR Close #16394
2017-04-28 17:41:50 -05:00
Tobias Bosch aa8bba4865 fix(core): allow to detach `OnPush` components (#16394)
Fixes #9720
2017-04-28 17:41:45 -05:00
Tobias Bosch 392d584572 fix(core): allow directives to inject the component’s `ChangeDetectorRef`. (#16394)
When a directive lives on the same element as a component
(e.g. `<my-comp myDir>`), the directive was not able to get hold
of the `ChangeDetectorRef` of the component on that element. However,
as directives are supposed to decorate components, this is incorrect.

This commit enables this use case.

Closes #12816
2017-04-28 17:41:31 -05:00
Christoph Krautz 900a88b15d feat(core): allow custom selector when bootstrapping components (#15668)
- fixes #7136

PR Close #15668
2017-04-28 17:41:04 -05:00
Alex Eagle da668848c9 fix(core): distribute externs for testability API (#16179)
Workaround for #11119

PR Close #16179
2017-04-19 22:46:11 -05:00
Miško Hevery 5293794316 fix: turn on nullability in the code base. 2017-04-18 12:07:33 -07:00
Miško Hevery 728c9d0632 fix(platform-browser): Update types for TypeScript nullability support
Closes #15898
2017-04-18 12:07:33 -07:00
Victor Berchet cb5a7efa91 fix(core): key-value differ changes iteration (#15968)
fixes #14997
2017-04-14 09:03:16 -07:00
Miško Hevery 09d9f5fe54 fix(compiler): Update types for TypeScript nullability support 2017-04-10 15:26:33 -06:00
Tobias Bosch 14fd78fd85 fix(core): fix inheritance in JIT mode for TS 2.1 (#15599)
Fixes #15502
2017-03-29 16:14:51 -07:00
Victor Berchet d58a242fe7 refactor(router): cleanup & simplification (#15436) 2017-03-29 09:44:04 -07:00
Miško Hevery 910c0d9ee7 fix(core): Update types for TypeScript nullability support (#15472) 2017-03-29 09:34:45 -07:00
Shai Reznik 49162784a8 docs(core): fix API docs for `Injector.get` 2017-03-28 16:57:22 -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
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
Dzmitry Shylovich b7fa5dec21 fix(core): improve error msg for invalid KeyValueDiffer.diff arg (#15489)
Closes #15402
2017-03-28 09:37:40 -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
Ward Bell 816b389759 docs: in doc comments, replace [aA]ngular2 with Angular (#15463) 2017-03-27 09:44:35 -07:00
Dzmitry Shylovich c17b912eb9 refactor: use object spread operator rather than merge (#15426) 2017-03-24 14:45:33 -07:00
Igor Minar b800a0c824 fix: prevent strictNullChecks support until #15432 is fixed (#15434) 2017-03-23 14:54:19 -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
Victor Berchet ea49a95bd9 fix(upgrade): component injectors should not link the module injector tree (#15385) 2017-03-22 15:22:38 -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
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
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
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
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
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
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
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
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 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
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
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
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