cookbook/index.jade

./dependency-injection.jade partial.
This commit is contained in:
Zhimin(Rex) YE 2016-04-24 11:21:07 +01:00
parent 6943fd58a9
commit c82e705640
2 changed files with 50 additions and 8 deletions

View File

@ -4,28 +4,49 @@ include ../_util-fns
Dependency Injection is a powerful pattern for managing code dependencies. Dependency Injection is a powerful pattern for managing code dependencies.
In this cookbook we will explore many of the features of Dependency Injection (DI) in Angular. In this cookbook we will explore many of the features of Dependency Injection (DI) in Angular.
依赖注入是一个强大的管理代码依赖链的架构模式。在这个“食谱”中我们会讨论Angular依赖注入的许多特性。
<a id="toc"></a> <a id="toc"></a>
:marked :marked
## Table of contents ## Table of contents
## 目录
[Application-wide dependencies](#app-wide-dependencies) [Application-wide dependencies](#app-wide-dependencies)
[应用程序全范围依赖](#app-wide-dependencies)
[External module configuration](#external-module-configuration) [External module configuration](#external-module-configuration)
[外部模块设置](#external-module-configuration)
[*@Injectable* and nested service dependencies](#nested-dependencies) [*@Injectable* and nested service dependencies](#nested-dependencies)
[*@Injectable*和嵌套服务的依赖](#nested-dependencies)
[Limit service scope to a component subtree](#service-scope) [Limit service scope to a component subtree](#service-scope)
[服务作用范围限制在一个组件数内](#service-scope)
[Multiple service instances (sandboxing)](#multiple-service-instances) [Multiple service instances (sandboxing)](#multiple-service-instances)
[多个服务实例(sandboxing)](#multiple-service-instances)
[Qualify dependency lookup with *@Optional* and *@Host*](#qualify-dependency-lookup) [Qualify dependency lookup with *@Optional* and *@Host*](#qualify-dependency-lookup)
[ 使用*@Optional*和*@Host*装饰来调用依赖](#qualify-dependency-lookup)
[Inject the component's DOM element](#component-element) [Inject the component's DOM element](#component-element)
[注入组件的DOM元素](#component-element)
[Define dependencies with providers](#providers) [Define dependencies with providers](#providers)
[使用提供者providers定义依赖](#providers)
* [The *provide* function](#provide) * [The *provide* function](#provide)
* [useValue - the *value provider*](#usevalue)
* [useClass - the *class provider*](#useclass) * [*提供者provide*功能](#provide)
* [useValue - the *value provider*](#usevalue)
* [useClass - the *class provider*](#useclass)
* [useExisting - the *alias provider*](#useexisting) * [useExisting - the *alias provider*](#useexisting)
* [useFactory - the *factory provider*](#usefactory) * [useFactory - the *factory provider*](#usefactory)

View File

@ -3,29 +3,50 @@ include ../_util-fns
// #docregion cookbook // #docregion cookbook
:marked :marked
# Angular 2 Cookbook # Angular 2 Cookbook
# Angular 2 Cookbook
The *Cookbook* offers answers to common implementation questions. The *Cookbook* offers answers to common implementation questions.
这个*“烹饪书”*提供常见应用问题的答案。
Each cookbook chapter is a collection of recipes focused on a particular Angular 2 feature or application challenge Each cookbook chapter is a collection of recipes focused on a particular Angular 2 feature or application challenge
such as data binding, cross-component interaction, and communicating with a remote server via HTTP. such as data binding, cross-component interaction, and communicating with a remote server via HTTP.
每个“烹饪书”章节都是一套“食谱”它们都是针对一个特定的Angular 2特征或者应用挑战比如数据绑定、跨越组件交互和通过HTTP来与远程服务器交互等。
.l-sub-section .l-sub-section
:marked :marked
The cookbook is just getting started. Many more recipes are on the way. The cookbook is just getting started. Many more recipes are on the way.
本Cookbook只是一个开始。更多“食谱”正在编写中。
:marked :marked
Each cookbook chapter links to a live sample with every recipe included. Each cookbook chapter links to a live sample with every recipe included.
每个“烹饪书”章节都链接了一个在线例子,它包含了每个“食谱”。
Recipes are deliberately brief and code-centric. Recipes are deliberately brief and code-centric.
“食谱”都是有意的简略和以代码为中心。
Each recipe links to a chapter of the Developer Guide or the API Guide Each recipe links to a chapter of the Developer Guide or the API Guide
每个“食谱”都与开发者指南或者API指南里面的一章相关联。
where you can learn more about the purpose, context, and design choices behind the code snippets. where you can learn more about the purpose, context, and design choices behind the code snippets.
(在这些关联章节里)你可以学到更多关于代码片段后面目的、前后关系和设计选择等。
## Feedback ## Feedback
The cookbook is a perpetual *work-in-progress*. The cookbook is a perpetual *work-in-progress*.
这个“烹饪书”是一个持续的*正在进行中*的工作。
We welcome feedback! Leave a comment by clicking the icon in upper right corner of the banner. We welcome feedback! Leave a comment by clicking the icon in upper right corner of the banner.
我们欢迎你的反馈!点击横幅右上角下面的图标来留言。
Post *documentation* issues and pull requests on the Post *documentation* issues and pull requests on the
[angular.io](https://github.com/angular/angular.io) github repository. [angular.io](https://github.com/angular/angular.io) github repository.
在[angular.io](https://github.com/angular/angular.io) github仓库提交*文档*议题和Pull requests。
Post issues with *Angular 2 itself* to the [angular](https://github.com/angular/angular) github repository. Post issues with *Angular 2 itself* to the [angular](https://github.com/angular/angular) github repository.
在[angular](https://github.com/angular/angular)提交*Angular 2 自己*的议题。
// #enddocregion cookbook // #enddocregion cookbook