minor fixes for dynamic forms,

form-validation
upgrade
This commit is contained in:
Zhimin YE 2016-11-04 12:41:10 +00:00
parent e4c327c2d1
commit 93f08c3723
3 changed files with 11 additions and 3 deletions

View File

@ -52,7 +52,7 @@ include ../_util-fns
:marked :marked
**See the <live-example name="cb-dynamic-form"></live-example>**. **See the <live-example name="cb-dynamic-form"></live-example>**.
**参见<live-example name="cb-dynamic-form"></live-example>**。 **参见<live-example name="cb-dynamic-form">在线例子</live-example>**。
.l-main-section .l-main-section

View File

@ -133,7 +133,7 @@ a#template1
:marked :marked
#### Why check _dirty_ and _touched_? #### Why check _dirty_ and _touched_?
### 为何检查**dirty**和**touched** #### 为何检查**dirty**和**touched**
We shouldn't show errors for a new hero before the user has had a chance to edit the value. We shouldn't show errors for a new hero before the user has had a chance to edit the value.
The checks for `dirty` and `touched` prevent premature display of errors. The checks for `dirty` and `touched` prevent premature display of errors.
@ -476,7 +476,7 @@ a#reactive
### Component template ### Component template
## 组件模板 ### 组件模板
We begin by changing the `<form>` tag so that it binds the Angular `formGroup` directive in the template We begin by changing the `<form>` tag so that it binds the Angular `formGroup` directive in the template
to the `heroForm` property in the component class. to the `heroForm` property in the component class.

View File

@ -1675,14 +1675,22 @@ code-example(format="").
:marked :marked
### Why declare _angular_ as _any_? ### Why declare _angular_ as _any_?
### 为何将*Angular*声明为*any*
A strongly typed `angular` reference to Angular 1 would be great. A strongly typed `angular` reference to Angular 1 would be great.
But we can't import its <a href="https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#support-for-umd-module-definitions" target="_blank">UMD typings</a> But we can't import its <a href="https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#support-for-umd-module-definitions" target="_blank">UMD typings</a>
library, `@types/angular`, without also importing Angular 1 itself via `import * as angular from 'angular'`. library, `@types/angular`, without also importing Angular 1 itself via `import * as angular from 'angular'`.
如果能在Angular 1中使用强类型的`angular`引用就太好了!
但是在不同时通过`import * as angular from 'angular'`导入Angular 1本身时我们不能导入Angular 2的 <a href="https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#support-for-umd-module-definitions" target="_blank">UMD类型</a>库`@types/angular`。
Angular 1 is currently loaded by a script tag in `index.html` and Angular 1 is currently loaded by a script tag in `index.html` and
switching to an ES6 import at this time is not worth the considerable effort. switching to an ES6 import at this time is not worth the considerable effort.
Instead we declare `angular` as an untyped `any` to avoid typing errors. Instead we declare `angular` as an untyped `any` to avoid typing errors.
Angular 1目前是被`index.html`里的脚本标签加载的目前不值得将其切换到ES6导入。
我们声明`angular`为无类型的`any`来防止类型错误。
:marked :marked
We can then make an adapter by instantiating the class: We can then make an adapter by instantiating the class: