Commit Graph

242 Commits

Author SHA1 Message Date
WilliamKoza 94b62c963d fix(common) add interface PipeTransform to Async pipe (#14049)
PR Close #14049
2017-01-29 12:18:55 -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
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
Matthew Hegarty 1f54040ef4 docs(common): fix a typo on the DatePipe API docs (#14060) 2017-01-24 10:21:59 -08: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
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
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 5cb2008e6c docs(NgPlural): fix API docs
Fixes #13786
2017-01-09 19:32:42 -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
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
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 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
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
Brandon a23fa94ca8 fix(common): capitalize first letter of all words in TitleCasePipe (#13511) 2016-12-16 15:24:26 -08:00
Trotyl Yu 732f446ad2 docs(common): fix ngIf example (#13496) 2016-12-15 13:07:36 -08:00
Pawel Kozlowski d036165a19 refactor: remove intl from facades (#13404)
The existing intl.ts file is not a facade but
rather a set of utils used by i18n-related pipes only.
As such moving it back to common module so those utils
are not used accidently from other places.
2016-12-13 12:34:50 -08:00
Misko Hevery 20bed46737 docs(Location): updating Location docs and adding example
closes #11500
2016-12-12 11:19:21 -08:00
Jesús Rodríguez fb38fba8f9 chore: convert hash_location_strategy example to a tested spec 2016-12-12 11:19:05 -08:00
Dzmitry Shylovich 56dce0e26d feat(common): export NgLocaleLocalization (#13367)
Closes #11921
2016-12-12 11:16:12 -08:00
Misko Hevery b4db73d0bf feat: ngIf now supports else; saves condition to local var
NgIf syntax has been extended to support else clause to display template
when the condition is false. In addition the condition value can now
be stored in local variable, for later reuse. This is especially useful
when used with the `async` pipe.

Example:

```
<div *ngIf="userObservable | async; else loading; let user">
  Hello {{user.last}}, {{user.first}}!
</div>
<template #loading>Waiting...</template>
```

closes #13061
closes #13297
2016-12-09 11:19:08 -08:00
Victor Berchet 61d7c1e0b3 feat(common): add a `titlecase` pipe (#13324)
closes #11436
2016-12-08 16:33:24 -08:00
Miško Hevery 16efb13dd1 fix: display framework version on bootstrapped component (#13252) 2016-12-06 16:21:07 -08:00
Victor Berchet 66b6fc010d refactor(common): unify export structure 2016-12-06 10:40:38 -08:00
Victor Berchet 307c4693dc refactor(router): code cleanup 2016-12-05 10:54:10 -08:00
Victor Berchet 82c81cd0d2 fix(common): make sure the plural category exists (#13169)
fixes #12379
2016-12-01 13:26:24 -08:00
Victor Savkin e628b66cca feat(build): record angular version in the dom (#13164) 2016-11-30 13:52:08 -08:00
Tim Blair 4a09251921 doc(common): fix a typo in async pipe 2016-11-28 14:11:45 -08:00
Alex Eagle 664a6273e1 feature(tsc-wrapped): add option for closure compiler JSDoc annotations 2016-11-18 09:37:40 -08:00
Joao Dias 77ee27c59e refactor(): use const and let instead of var 2016-11-12 16:40:17 -08:00
Bruno da Silva joão 2aba8b0ff2 fix(common): no TZ Offset added by DatePipe for dates without time (#12380) 2016-11-10 14:57:04 -08:00
Dzmitry Shylovich 3dc61779f0 fix(DatePipe): handle empty string (#12374) 2016-11-08 15:45:12 -08:00
Victor Berchet 4708b248d5 fix(common): I18nSelectPipe selects other case on default 2016-11-08 15:44:18 -08:00
Pawel Kozlowski f3793b5953 fix(NgClass): throw a descriptive error when CSS class is not a string (#12662)
Fixes #12586
2016-11-07 12:23:31 -08:00
Tobias Bosch d8f23f4b7f fix(common): `NgSwitch` - don’t create the default case if another case matches (#12726)
This also simplifies the implementation of `NgSwitch`.

Closes #11297
Closes #9420
2016-11-07 12:22:36 -08:00
Trotyl Yu 4aaae3eada docs(common): fix a typo in ngStyle API docs 2016-11-03 10:27:05 -07:00
Tobias Bosch 74ede9aa9b refactor(core): don’t store view factory in `TemplateRef`
Instead, generate `createEmbeddedView`.
2016-11-02 17:06:27 -07:00
Michael George Attard 3045d02b9a docs(pipes): minor fix and improvements 2016-10-31 12:39:21 +01:00
Victor Berchet 7b8dae19af refactor(facade): cleanup Intl facade 2016-10-28 15:52:52 -07:00
michaelgeorgeattard 02f1222a8d docs(common): minor corrections/improvements for NgClass (#12327) 2016-10-25 00:12:09 +02:00
Victor Berchet 76dd026447 refactor: remove some facades (#12335) 2016-10-19 13:42:39 -07:00
Andrei Tserakhau f77ab6a2d2 feat(datePipe): support narrow forms for month and weekdays (#12297)
Closes #12294
2016-10-19 10:05:13 -07:00
John Anthony d61ecf0663 docs(NgSwitch): fix mismatched tags in example (#12270) 2016-10-17 22:51:56 -07:00
Michael George Attard a5419608e0 docs(ngIf): minor improvements 2016-10-17 22:50:12 -07:00
Michael George Attard 5f95bf1dd2 refactor(common): remove redundant type 2016-10-17 22:50:12 -07:00
Victor Berchet fdf4309b50 perf(common): optimize NgSwitch default case
relates to #11297
2016-10-12 17:11:46 -07:00