Deliver web apps with confidence 🚀
Find a file
Tobias Bosch f2bbef3e33 fix(core): allow to query content of templates that are stamped out at a different place
Previously, if a `TemplateRef` was created in a `ViewContainerRef`
at a different place, the content was not query able at all.

With this change, the content of the template can be queried
as if it was stamped out at the declaration place of the template.

E.g. in the following example, the `QueryList<ChildCmp>` will
be filled once the button is clicked.

```
@Component({
  selector: ‘my-comp’,
  template: ‘<button #vc (click)=“createView()”></button>’
})
class MyComp {
  @ContentChildren(ChildCmp)
  children: QueryList<ChildCmp>;

  @ContentChildren(TemplateRef)
  template: TemplateRef;

  @ViewChild(‘vc’, {read: ViewContainerRef})
  vc: ViewContainerRef;

  createView() {
    this.vc.createEmbeddedView(this.template);
  }
}

@Component({
  template: `
<my-comp>
  <template><child-cmp></child-cmp></template>
</my-comp>
`
})
class App {}
```

Closes #12283
Closes #12094
2016-11-04 10:50:27 -07:00
.github docs(gh): try to improve the issue template (#11891) 2016-09-30 16:40:56 -07:00
docs docs(public_api): fix missing backtick 2016-10-07 17:23:08 -07:00
modules fix(core): allow to query content of templates that are stamped out at a different place 2016-11-04 10:50:27 -07:00
scripts build: ensure necessary symlinks created on windows 2016-10-27 12:13:39 -07:00
tools refactor(compiler): remove view factories, use view classes directly 2016-11-02 20:58:48 -07:00
.bowerrc chore(dgeni): clean up legacy typings bundle creation 2015-10-29 21:19:59 +00:00
.clang-format feat(tooling): Add a .clang-format for automated JavaScript formatting. 2015-04-02 08:44:34 -07:00
.editorconfig chore(.editorconfig): include markdown config 2015-01-27 00:14:48 -08:00
.gitattributes chore: force lf EOL for ts files (#11143) 2016-08-29 12:41:58 -07:00
.gitignore chore(git): cleanup .gitignore 2016-09-02 15:58:46 -07:00
.nvmrc chore(node): allow current node version 2016-09-19 16:24:31 -07:00
.travis.yml chore(ci): re-enable browserstack tests in ci 2016-10-20 10:01:51 -07:00
bower.json refactor(benchmarks): make tree benchmark work again 2016-08-29 12:42:57 -07:00
browser-providers.conf.js refactor: add license header to JS files & format files (#12081) 2016-10-04 20:39:20 -07:00
build.sh refactor(playground): update gestures playground to use latest hammer.js 2016-10-31 14:43:04 -07:00
CHANGELOG.md chore: update changelog 2016-11-02 12:34:21 -07:00
circle.yml chore(lint): re-enable clang-format on tools/ 2016-05-26 15:46:03 -07:00
COMMITTER.md chore(docs): update the merge process docs 2015-12-23 02:32:02 +00:00
CONTRIBUTING.md docs(CONTRIBUTING.md): fix stackoverflow broken link url (#12705) 2016-11-04 10:21:11 -07:00
DEVELOPER.md docs(DEVELOPER.md): fix typos on "Tests" section (#12029) 2016-10-02 14:19:47 -07:00
gulpfile.js chore(lint): extend linting to all modules and tools 2016-10-31 14:24:27 -07:00
karma-js.conf.js feat(ngUpgrade): add support for AoT compiled upgrade applications 2016-10-19 15:27:49 -07:00
LICENSE Update change from Apache to MIT license 2016-01-08 13:41:58 -08:00
NAMING.md refactor(ngProbe): rename to ng.probe 2015-08-31 21:32:10 +00:00
npm-shrinkwrap.clean.json refactor(playground): update gestures playground to use latest hammer.js 2016-10-31 14:43:04 -07:00
npm-shrinkwrap.json refactor(playground): update gestures playground to use latest hammer.js 2016-10-31 14:43:04 -07:00
npm-shrinkwrap.readme.md chore(lint): replace gulp check-task with tslint no-jasmine-focus rule 2016-10-28 15:53:15 -07:00
package.json chore(release): cut v2.2.0-rc.0 2016-11-03 00:28:29 +01:00
protractor-e2e.conf.js refactor: add license header to JS files & format files (#12081) 2016-10-04 20:39:20 -07:00
protractor-examples-e2e.conf.js refactor: add license header to JS files & format files (#12081) 2016-10-04 20:39:20 -07:00
protractor-perf.conf.js refactor: add license header to JS files & format files (#12081) 2016-10-04 20:39:20 -07:00
publish-packages.sh chore: remove deprecated router 2/2 2016-08-09 15:24:14 -07:00
README.md docs(readme): remove incorrect download count badge 2016-10-05 11:37:28 -07:00
SAVED_REPLIES.md docs(saved-replies): order the replies as shown in github (#12153) 2016-10-07 13:52:18 -07:00
shims_for_IE.js Revert "refactor: add license header to JS files & format files (#12035)" 2016-10-04 14:06:41 -07:00
test-main.js refactor: add license header to JS files & format files (#12081) 2016-10-04 20:39:20 -07:00
test.sh build(test.sh): clear dist directory when the script starts 2016-09-06 15:35:10 -07:00
TOOLS.md chore(docs): remove sentences for dart (#10781) 2016-08-16 19:38:49 -07:00
TRIAGE_AND_LABELS.md doc(triage): add info about user pain, frequency and severity labels 2016-10-05 15:58:45 -07:00
tslint.json chore(lint): replace enforce-copyright-header rule with the native equivalent 2016-10-31 11:27:35 -07:00

Build Status CircleCI Join the chat at https://gitter.im/angular/angular Issue Stats Issue Stats npm version

Sauce Test Status
Safari (7+), iOS (7+), Edge (14) and IE mobile (11) are tested on BrowserStack.

Angular

Angular is a development platform for building mobile and desktop web applications. This is the repository for Angular 2 Typescript/JavaScript (JS).

Angular2 for Dart can be found at dart-lang/angular2.

Quickstart

Get started in 5 minutes.

Want to help?

Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for contributing and then check out one of our issues in the hotlist: community-help.