94 Commits

Author SHA1 Message Date
Victor Berchet
bf8eb41248 feat(compiler): introduce <ng-template>, deprecate <template> and template attribute
The rationale of this change is to improve the inter-operability with web
components that might make use of the `<template>` tag.

DEPRECATION

The template tags and template attribute are deprecated:

    <template ngFor [ngFor]=items let-item><li>...</li></template>
    <li template="ngFor: let item of items">...</li>

should be rewritten as:

    <ng-template ngFor [ngFor]=items let-item><li>...</li></ng-template>

Note that they still be supported in 4.x with a deprecartion warning in
development mode.

MIGRATION

- `template` tags (or elements with a `template` attribute) should be rewritten
as a `ng-template` tag,
- `ng-content` selectors should be updated to referto a `ng-template` where they
use to refer to a template: `<ng-content selector="template[attr]">` should be
rewritten as `<ng-content selector="ng-template[attr]">`
- if you consume a component relying on your templates being actual `template`
elements (that is they include a `<ng-content selector="template[attr]">`). You
should  still migrate to `ng-template` and make use of `ngProjectAs` to override
the way `ng-content` sees the template:
`<ng-template projectAs="template[attr]">`
- while `template` elements are deprecated in 4.x they continue to work.
2017-02-23 20:03:16 -08:00
Matias Niemelä
830393d234 refactor(animations): support browser animation rendering (#14578) 2017-02-22 15:14:49 -08:00
Jason Aden
de795ea233 perf: distrubute smaller bundled code and include es2015 bundle
TypeScript compiler will now build to ES2015 code and modules. Babili is used to minify ES2015
code, providing an initial optimization that we couldn't previously get just from Uglify. Uses
Babel to convert ES2015 to UMD/ES5 code, and Uglify to minimize the output.
2017-02-21 20:48:55 -08:00
Victor Berchet
d6a58f9f70 feat(core): make new Inject() optional for deps specified as InjectionToken (#14486)
fixes #10625
2017-02-20 16:20:45 -08:00
Alex Eagle
ef32e6b0d0 fix: build and test fixes for TS 2.1 (#13294) 2017-02-08 11:32:40 -06: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
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
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
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
Victor Berchet
7295a5e7f2 refactor: format and lint code 2016-12-12 11:30:25 -08:00
Misko Hevery
20bed46737 docs(Location): updating Location docs and adding example
closes #11500
2016-12-12 11:19:21 -08:00
Misko Hevery
2a5012d515 chore: Add @types/systemjs 2016-12-12 11:19:05 -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
Victor Berchet
aaf6e05f56 refactor(commonn): fix lint issues
closes #13352
2016-12-09 15:37:46 -08:00
Victor Berchet
c8baf51f4f style: clang-format the code 2016-12-09 11:19:55 -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
Misko Hevery
e15a3f273f fix: Better instructions on running examples and their tests 2016-12-09 11:16:49 -08:00
Bowen Ni
4cbf8ccf05 Keep console.log that are not called during compilation. 2016-11-23 15:47:02 -08:00
Bowen Ni
2c02d34c05 refactor(lint): Don't allow console.log
Enable tslint check for `console.log` as a follow-up to
https://github.com/angular/angular/issues/13018
2016-11-23 15:47:01 -08:00
Peter Bacon Darwin
009d545787 chore(examples): add upgrade/static example 2016-11-16 09:18:10 -08:00
Peter Bacon Darwin
53c25210a6 chore(examples): support upgrade/static examples 2016-11-16 09:18:10 -08:00
Joao Dias
77ee27c59e refactor(): use const and let instead of var 2016-11-12 16:40:17 -08:00
Victor Berchet
1bd858fb43 build(examples): upgrade to protractor 4.0.9 (#12803)
closes #12798
2016-11-10 18:13:11 -08:00
Joao Dias
e86573bac8 chore(lint): replace gulp check-task with tslint no-jasmine-focus rule
fixes #11800
2016-10-28 15:53:15 -07:00
Alex Eagle
41c8c30973 chore(lint): remove unused imports (#11923)
This was done automatically by tslint, which can now fix issues it finds.
The fixer is still pending in PR https://github.com/palantir/tslint/pull/1568
Also I have a local bugfix for https://github.com/palantir/tslint/issues/1569
which causes too many imports to be deleted.
2016-09-27 17:12:25 -07:00
Kara
bf81b06a28 docs(forms): add select control examples (#11728) 2016-09-19 16:25:33 -07:00
Kara
fa4723a208 docs(forms): add radio button examples (#11676) 2016-09-19 10:41:20 -07:00
Victor Berchet
54b41f57be docs(Host): fix the API example (#11684)
fixes #11681
2016-09-18 15:56:13 -07:00
vsavkin
003294d5df docs(core): fix examples 2016-09-14 14:53:30 -07:00
vsavkin
5972fdc817 docs(core): extract how to examples 2016-09-14 14:53:30 -07:00
Misko Hevery
2c42a50fc3 docs(pipes): updated pipe documentation 2016-09-14 14:32:09 -07:00
Misko Hevery
caa1cd2470 docs(pipes): move pipe examples to the common folder 2016-09-14 14:26:00 -07:00
Alex Eagle
5fad37df69 Revert "chore(core): update public api file"
This reverts commit 727c2b38a4355e3ecb708487aa377ed54e4e8375.

Revert "docs(core): updates query decorator docs"

This reverts commit b6287ccc5126da9c1a052bd28b3a9e2743f67eae.

Revert "docs(core): extract how to examples"

This reverts commit 69e8ace8848e55c9605c1feab7d642bf46bddb4e.
2016-09-14 13:34:25 -07:00
vsavkin
69e8ace884 docs(core): extract how to examples 2016-09-14 13:22:09 -07:00
Tobias Bosch
0a2132ef10 docs(di): update docs on di 2016-09-14 11:57:31 -07:00
Tobias Bosch
d299ce4bcf docs(lifecycle): update docs for lifecycle hooks 2016-09-14 11:51:03 -07:00
Tobias Bosch
0b9425bbb4 fix(examples): make them work with noImplicitAny and declarations:true 2016-09-14 11:29:31 -07:00
Tobias Bosch
1a035a0dc7 build(examples): include in main tsconfig.json
Also rename `examples/tsconfig.json` into `examples/tsconfig-build.json`
so that it does not shadow the main `tsconfig.json` in editors

Also adds `noImplicitAny` and `declarations`
`examples/tsconfig.json`.
2016-09-14 11:29:31 -07:00
Victor Berchet
84b4338ab5 build(example): fix tsconfig (#11593) 2016-09-14 07:40:58 -07:00
Igor Minar
57f0269491 build(examples): fail build.sh if errors are found 2016-09-13 21:48:58 -07:00
Igor Minar
4e6c41b3a1 build(examples): work around protractor typings issues and fix existing type errors
This works around the typings issues until we have a build of protractor with typings that don't
polute global types via ambient type definitions
2016-09-13 21:48:58 -07:00
Kara
e71558ba89 docs(forms): update docs for FormBuilder (#11548) 2016-09-13 13:23:31 -07:00
vsavkin
60e49a7e4b docs(core): add an example of using ViewChildren 2016-09-13 11:28:12 -07:00
vsavkin
c71e35cbf5 docs(core): add an example of using ViewChild 2016-09-13 11:28:12 -07:00
vsavkin
1348c65b0c docs(core): add an example of using ContentChildren 2016-09-13 11:28:12 -07:00
vsavkin
ff03d87cdd docs(core): add an example of using ContentChild 2016-09-13 11:28:12 -07:00
Kara
26d1423ae9 docs(forms): update docs for NgForm (#11547) 2016-09-12 17:01:04 -07:00
Kara
c9513b713a docs(forms): add example apps for ngModelGroup (#11525) 2016-09-12 11:45:48 -07:00