fix styleguide
This commit is contained in:
parent
b1f7a6950c
commit
754e11dc13
|
@ -195,9 +195,9 @@ a(id='toc')
|
||||||
|
|
||||||
随着应用程序的成长,本法则会变得越来越重要。
|
随着应用程序的成长,本法则会变得越来越重要。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -246,9 +246,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**小函数帮助避免一些大函数容易产生的那些与外界共享变量、创建意外的闭包或与依赖之间产生意外耦合等隐蔽的错误。
|
**为何?**小函数帮助避免一些大函数容易产生的那些与外界共享变量、创建意外的闭包或与依赖之间产生意外耦合等隐蔽的错误。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -296,9 +296,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**目录和文件的名字应该清楚的说明它们的用途。比如`app/heroes/hero-list.component.ts`包含了一个用来维护英雄列表的组件。
|
**为何?**目录和文件的名字应该清楚的说明它们的用途。比如`app/heroes/hero-list.component.ts`包含了一个用来维护英雄列表的组件。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -359,9 +359,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**与自动化任务的模式匹配。
|
**为何?**与自动化任务的模式匹配。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -484,9 +484,9 @@ table(width="100%")
|
||||||
user-profile.service.ts
|
user-profile.service.ts
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -568,9 +568,9 @@ table(width="100%")
|
||||||
logger.service.ts
|
logger.service.ts
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -612,9 +612,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/02-05/main.ts', '', 'main.ts')
|
+makeExample('style-guide/ts/02-05/main.ts', '', 'main.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -641,9 +641,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**Angular HTML解析器是大小写敏感的,它识别小写驼峰写法。
|
**为何?**Angular HTML解析器是大小写敏感的,它识别小写驼峰写法。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -738,9 +738,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/02-08/app/shared/validate.directive.ts', 'example', 'app/shared/validate.directive.ts')
|
+makeExample('style-guide/ts/02-08/app/shared/validate.directive.ts', 'example', 'app/shared/validate.directive.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -790,9 +790,9 @@ table(width="100%")
|
||||||
init-caps.pipe.ts
|
init-caps.pipe.ts
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -876,9 +876,9 @@ table(width="100%")
|
||||||
init-caps.pipe.spec.ts
|
init-caps.pipe.spec.ts
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -931,15 +931,16 @@ table(width="100%")
|
||||||
heroes.e2e-spec.ts
|
heroes.e2e-spec.ts
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
### <a id="02-12"></a>Angular NgModule Names
|
### <a id="02-12"></a>Angular NgModule Names
|
||||||
### <a id="02-12"></a>Angular NgModule命名
|
### <a id="02-12"></a>Angular NgModule命名
|
||||||
#### <a href="#02-12">Style 02-12</a>
|
#### <a href="#02-12">Style 02-12</a>
|
||||||
|
#### <a href="#02-12">风格 02-12</a>
|
||||||
|
|
||||||
.s-rule.do
|
.s-rule.do
|
||||||
:marked
|
:marked
|
||||||
|
@ -1046,9 +1047,9 @@ table(width="100%")
|
||||||
heroes-routing.module.ts
|
heroes-routing.module.ts
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1061,8 +1062,10 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
### <a id="03-01"></a>类
|
### <a id="03-01"></a>Class
|
||||||
#### <a href="#03-01">风格03-01</a>
|
### <a id="03-01"></a>类
|
||||||
|
#### <a href="#03-01">Style 03-01</a>
|
||||||
|
#### <a href="#03-01">风格03-01</a>
|
||||||
|
|
||||||
.s-rule.do
|
.s-rule.do
|
||||||
:marked
|
:marked
|
||||||
|
@ -1089,9 +1092,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/03-01/app/core/exception.service.ts', 'example', 'app/shared/exception.service.ts')
|
+makeExample('style-guide/ts/03-01/app/core/exception.service.ts', 'example', 'app/shared/exception.service.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1159,9 +1162,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/03-02/app/core/data.service.ts', '', 'app/shared/data.service.ts')
|
+makeExample('style-guide/ts/03-02/app/core/data.service.ts', '', 'app/shared/data.service.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1219,9 +1222,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/03-03/app/core/hero-collector.service.ts', 'example', 'app/shared/hero-collector.service.ts')
|
+makeExample('style-guide/ts/03-03/app/core/hero-collector.service.ts', 'example', 'app/shared/hero-collector.service.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1266,8 +1269,8 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/03-04/app/core/toast.service.ts', 'example', 'app/shared/toast.service.ts')
|
+makeExample('style-guide/ts/03-04/app/core/toast.service.ts', 'example', 'app/shared/toast.service.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1312,9 +1315,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/03-06/app/heroes/shared/hero.service.ts', 'example', 'app/heroes/shared/hero.service.ts')
|
+makeExample('style-guide/ts/03-06/app/heroes/shared/hero.service.ts', 'example', 'app/heroes/shared/hero.service.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1339,12 +1342,13 @@ a(href="#toc") 回到顶部
|
||||||
所有内容都遵循每个文件单个特性的原则。每个组件、服务和管道都在自己的文件里。
|
所有内容都遵循每个文件单个特性的原则。每个组件、服务和管道都在自己的文件里。
|
||||||
所有第三方程序包都被保存到其它目录里而不在`app`目录里,我们不会修改它们,所以不希望它们弄乱我们的应用程序。使用本指南介绍的文件命名约定。
|
所有第三方程序包都被保存到其它目录里而不在`app`目录里,我们不会修改它们,所以不希望它们弄乱我们的应用程序。使用本指南介绍的文件命名约定。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
### <a id="04-01"></a>LIFT
|
||||||
### <a id="04-01"></a>LIFT
|
### <a id="04-01"></a>LIFT
|
||||||
#### <a href="#04-01">Style 04-01</a>
|
#### <a href="#04-01">Style 04-01</a>
|
||||||
#### <a href="#04-01">风格04-01</a>
|
#### <a href="#04-01">风格04-01</a>
|
||||||
|
@ -1372,8 +1376,8 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**LIFT提供了前后一致的结构,它具有扩展性强、模块化的特性。因为容易快速锁定代码,所以提高了开发者的效率。另外,检查应用结构是否合理的方法是问问自己:我们能快速打开与此特性有关的文件并开始工作吗?
|
**为何?**LIFT提供了前后一致的结构,它具有扩展性强、模块化的特性。因为容易快速锁定代码,所以提高了开发者的效率。另外,检查应用结构是否合理的方法是问问自己:我们能快速打开与此特性有关的文件并开始工作吗?
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1402,9 +1406,9 @@ a(href="#toc") 回到顶部
|
||||||
把相关的文件一起放在一个直观的位置可以节省时间。
|
把相关的文件一起放在一个直观的位置可以节省时间。
|
||||||
富有描述性的目录结构会让你和后面的维护者眼前一亮。
|
富有描述性的目录结构会让你和后面的维护者眼前一亮。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1447,9 +1451,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
当你有一组小型、紧密相关的特性时,违反*一物一文件*的规则可能会更好,这种情况下单一文件可能会比多个文件更容易发现和理解。注意这个例外。
|
当你有一组小型、紧密相关的特性时,违反*一物一文件*的规则可能会更好,这种情况下单一文件可能会比多个文件更容易发现和理解。注意这个例外。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1498,9 +1502,9 @@ s-why.s-why-last
|
||||||
还是根据你自己的舒适度而定吧。
|
还是根据你自己的舒适度而定吧。
|
||||||
除非创建新文件夹能有显著的价值,否则尽量使用扁平结构。
|
除非创建新文件夹能有显著的价值,否则尽量使用扁平结构。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1533,9 +1537,9 @@ a(href="#toc") 回到顶部
|
||||||
比如,把组件命名为`hero-view.component.html`是多余的,因为组件显然就是一个视图(view)。
|
比如,把组件命名为`hero-view.component.html`是多余的,因为组件显然就是一个视图(view)。
|
||||||
但如果它不是这么显著,或不符合常规,那就把它写出来。
|
但如果它不是这么显著,或不符合常规,那就把它写出来。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1650,9 +1654,9 @@ a(id='file-tree')
|
||||||
把组件放在专用目录中的方式广受欢迎,对于小型应用,还可以保持组件扁平化(而不是放在专用目录中)。
|
把组件放在专用目录中的方式广受欢迎,对于小型应用,还可以保持组件扁平化(而不是放在专用目录中)。
|
||||||
这样会把四个文件放在现有目录中,但是也会减少目录的嵌套。无论你如何选择,请保持一致。
|
这样会把四个文件放在现有目录中,但是也会减少目录的嵌套。无论你如何选择,请保持一致。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1714,9 +1718,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
a(href="#file-tree") 点这里查看目录和文件结构的范例
|
a(href="#file-tree") 点这里查看目录和文件结构的范例
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
|
@ -1753,9 +1757,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/04-08/app/app.module.ts', 'example', 'app/app.module.ts')
|
+makeExample('style-guide/ts/04-08/app/app.module.ts', 'example', 'app/app.module.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1824,9 +1828,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**特性模块易于隔离,以便测试。
|
**为何?**特性模块易于隔离,以便测试。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -1934,9 +1938,9 @@ a(href="#toc") 回到顶部
|
||||||
`)
|
`)
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2098,9 +2102,9 @@ a(href="#toc") 回到顶部
|
||||||
`AppModule`把工作委托给了导入的模块,而不是亲力亲为。
|
`AppModule`把工作委托给了导入的模块,而不是亲力亲为。
|
||||||
`AppModule`聚焦在它自己的主要任务上:作为整个应用的总指挥。
|
`AppModule`聚焦在它自己的主要任务上:作为整个应用的总指挥。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2143,9 +2147,9 @@ a(href="#toc") 回到顶部
|
||||||
`)
|
`)
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2171,9 +2175,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**这种目录让标识和隔离这些特性内容变得更轻松。
|
**为何?**这种目录让标识和隔离这些特性内容变得更轻松。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2194,9 +2198,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**直接导入并使用此模块会主动加载它,而我们原本的设计意图是按需加载它。
|
**为何?**直接导入并使用此模块会主动加载它,而我们原本的设计意图是按需加载它。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2232,9 +2236,9 @@ a(href="#toc") 回到顶部
|
||||||
app/app.component.html`)
|
app/app.component.html`)
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2283,9 +2287,9 @@ a(href="#toc") 回到顶部
|
||||||
app/app.component.html`)
|
app/app.component.html`)
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2337,9 +2341,9 @@ a(href="#toc") 回到顶部
|
||||||
app/heroes/heroes.component.css`)
|
app/heroes/heroes.component.css`)
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2392,9 +2396,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/05-12/app/heroes/shared/hero-button/hero-button.component.ts', 'example', 'app/heroes/shared/hero-button/hero-button.component.ts')
|
+makeExample('style-guide/ts/05-12/app/heroes/shared/hero-button/hero-button.component.ts', 'example', 'app/heroes/shared/hero-button/hero-button.component.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2429,9 +2433,9 @@ a(href="#toc") 回到顶部
|
||||||
app/app.component.html`)
|
app/app.component.html`)
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2465,9 +2469,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/05-14/app/shared/toast/toast.component.ts', 'example', 'app/shared/toast/toast.component.ts')
|
+makeExample('style-guide/ts/05-14/app/shared/toast/toast.component.ts', 'example', 'app/shared/toast/toast.component.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2518,9 +2522,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/05-15/app/heroes/hero-list/hero-list.component.ts', 'example', 'app/heroes/hero-list/hero-list.component.ts')
|
+makeExample('style-guide/ts/05-15/app/heroes/hero-list/hero-list.component.ts', 'example', 'app/heroes/hero-list/hero-list.component.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2567,9 +2571,9 @@ a(href="#toc") 回到顶部
|
||||||
app/app.component.html`)
|
app/app.component.html`)
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2602,16 +2606,16 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/05-17/app/heroes/hero-list/hero-list.component.ts', 'example', 'app/heroes/hero-list/hero-list.component.ts')
|
+makeExample('style-guide/ts/05-17/app/heroes/hero-list/hero-list.component.ts', 'example', 'app/heroes/hero-list/hero-list.component.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
## Directives
|
## Directives
|
||||||
## 指令
|
## 指令
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2644,9 +2648,9 @@ a(href="#toc") Back to top
|
||||||
+makeExample('style-guide/ts/06-01/app/app.component.html', null, 'app/app.component.html')
|
+makeExample('style-guide/ts/06-01/app/app.component.html', null, 'app/app.component.html')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2693,9 +2697,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/06-03/app/shared/validator2.directive.ts', '', 'app/shared/validator2.directive.ts')
|
+makeExample('style-guide/ts/06-03/app/shared/validator2.directive.ts', '', 'app/shared/validator2.directive.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2728,9 +2732,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/07-01/app/heroes/shared/hero.service.ts', 'example', 'app/heroes/shared/hero.service.ts')
|
+makeExample('style-guide/ts/07-01/app/heroes/shared/hero.service.ts', 'example', 'app/heroes/shared/hero.service.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2763,9 +2767,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**当某个服务有多个职责时,每个注入它的组件或服务都会承担这些职责的全部开销。
|
**为何?**当某个服务有多个职责时,每个注入它的组件或服务都会承担这些职责的全部开销。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2811,9 +2815,9 @@ a(href="#toc") 回到顶部
|
||||||
app/heroes/hero-list/hero-list.component.ts`)
|
app/heroes/hero-list/hero-list.component.ts`)
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2846,9 +2850,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/07-04/app/heroes/shared/hero-arena.service.ts', 'example', 'app/heroes/shared/hero-arena.service.ts')
|
+makeExample('style-guide/ts/07-04/app/heroes/shared/hero-arena.service.ts', 'example', 'app/heroes/shared/hero-arena.service.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2890,9 +2894,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**为何?**数据服务的实现可能有非常具体的代码来处理数据仓库,包括数据头(headers)、如何与数据交谈或者其它服务(比如`Http`)。把逻辑分离到数据服务可以把该逻辑封装到一个地方,对外部使用者(比如组件)隐藏具体的实施细节。
|
**为何?**数据服务的实现可能有非常具体的代码来处理数据仓库,包括数据头(headers)、如何与数据交谈或者其它服务(比如`Http`)。把逻辑分离到数据服务可以把该逻辑封装到一个地方,对外部使用者(比如组件)隐藏具体的实施细节。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2903,9 +2907,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
使用生命周期钩子来介入到Angular暴露的重要事件里。
|
使用生命周期钩子来介入到Angular暴露的重要事件里。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2933,9 +2937,9 @@ a(href="#toc") 回到顶部
|
||||||
+makeExample('style-guide/ts/09-01/app/heroes/shared/hero-button/hero-button.component.ts', 'example', 'app/heroes/shared/hero-button/hero-button.component.ts')
|
+makeExample('style-guide/ts/09-01/app/heroes/shared/hero-button/hero-button.component.ts', 'example', 'app/heroes/shared/hero-button/hero-button.component.ts')
|
||||||
:marked
|
:marked
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2946,9 +2950,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
有用的Angular工具和小提示
|
有用的Angular工具和小提示
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -2969,9 +2973,9 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**考虑**调整codelyzer的规则来满足你的需求。
|
**考虑**调整codelyzer的规则来满足你的需求。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
||||||
.l-main-section
|
.l-main-section
|
||||||
:marked
|
:marked
|
||||||
|
@ -3021,6 +3025,6 @@ a(href="#toc") 回到顶部
|
||||||
|
|
||||||
**考虑**使用[Vim](http://www.vim.org/)的[代码片断](https://github.com/mhartington/vim-angular2-snippets)来实施本风格指南。
|
**考虑**使用[Vim](http://www.vim.org/)的[代码片断](https://github.com/mhartington/vim-angular2-snippets)来实施本风格指南。
|
||||||
|
|
||||||
a(href="#toc") Back to top
|
a(href="#toc").to-top Back to top
|
||||||
|
|
||||||
a(href="#toc") 回到顶部
|
a(href="#toc").to-top 回到顶部
|
||||||
|
|
|
@ -3,6 +3,9 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||||
(function ($) {
|
(function ($) {
|
||||||
var content = document.querySelector('article');
|
var content = document.querySelector('article');
|
||||||
var footer = document.querySelector('.main-footer');
|
var footer = document.querySelector('.main-footer');
|
||||||
|
if(!content || !footer){
|
||||||
|
return;
|
||||||
|
}
|
||||||
processContainer(content);
|
processContainer(content);
|
||||||
processContainer(footer);
|
processContainer(footer);
|
||||||
|
|
||||||
|
@ -22,6 +25,9 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||||
* @param container
|
* @param container
|
||||||
*/
|
*/
|
||||||
function processContainer(container) {
|
function processContainer(container) {
|
||||||
|
if (!container) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var count = 0;
|
var count = 0;
|
||||||
for (var i = 0; i < container.children.length; i++) {
|
for (var i = 0; i < container.children.length; i++) {
|
||||||
var node = container.children[i];
|
var node = container.children[i];
|
||||||
|
@ -98,8 +104,6 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||||
addSpacingBetweenCnAndEn(sibling);
|
addSpacingBetweenCnAndEn(sibling);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.error('Error: ' + current.innerText);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +134,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
function isClonedNode(node1, node2) {
|
function isClonedNode(node1, node2) {
|
||||||
return node1.tagName === node2.tagName &&
|
return node1.tagName === node2.tagName && node1.tagName !== 'TR' &&
|
||||||
attributesToString(node1) === attributesToString(node2);
|
attributesToString(node1) === attributesToString(node2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue