angular-cn/modules/@angular/examples
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
..
_common refactor(animations): support browser animation rendering (#14578) 2017-02-22 15:14:49 -08:00
common feat(compiler): introduce `<ng-template>`, deprecate `<template>` and `template` attribute 2017-02-23 20:03:16 -08:00
compiler/ts/url_resolver refactor(): use const and let instead of var 2016-11-12 16:40:17 -08:00
core feat(core): make `new Inject()` optional for deps specified as `InjectionToken` (#14486) 2017-02-20 16:20:45 -08:00
facade/ts/async refactor(lint): Don't allow console.log 2016-11-23 15:47:01 -08:00
forms/ts refactor(lint): Don't allow console.log 2016-11-23 15:47:01 -08:00
http/ts repackaging: all the file moves 2016-05-01 20:51:00 -07:00
platform-browser/dom/debug/ts refactor: format and lint code 2016-12-12 11:30:25 -08:00
testing/ts docs(Location): updating Location docs and adding example 2016-12-12 11:19:21 -08:00
upgrade/static/ts fix: build and test fixes for TS 2.1 (#13294) 2017-02-08 11:32:40 -06:00
web_workers/ts repackaging: all the file moves 2016-05-01 20:51:00 -07:00
README.md style: clang-format the code 2016-12-09 11:19:55 -08:00
build.sh chore(examples): support upgrade/static examples 2016-11-16 09:18:10 -08:00
test.sh fix(build): test example directories with unit and e2e tests (#11296) 2016-09-07 16:04:33 -07:00
tsconfig-build.json docs(Location): updating Location docs and adding example 2016-12-12 11:19:21 -08:00

README.md

API Examples

This folder contains small example apps that get in-lined into our API docs. Each example contains tests for application behavior (as opposed to testing Angular's behavior) just like an Angular application developer would write.

Running the examples

# # execute the following command only when framework code changes
./build.sh

# run when test change
./modules/@angular/examples/build.sh  

# start server
$(npm bin)/gulp serve-examples

navigate to http://localhost:8001

Running the tests

 # run only when framework code changes
./build.sh

# run to compile tests and run them
./modules/@angular/examples/test.sh

NOTE: sometimes the http server does not exit properly and it retains the 8001 port. in such a case you can use lsof -i:8001 to see which process it is and then use kill to remove it. (Or in single command: lsof -i:8001 -t | xargs kill)