docs(API): 翻译完了 ElementRef

This commit is contained in:
Zhicheng Wang 2018-09-02 11:11:49 +08:00
parent 59425a1e5e
commit 3bfa4e5daa
2 changed files with 16 additions and 1 deletions

View File

@ -29,7 +29,7 @@
[x] |router/RouterModule | 2,227 | 0.69 [x] |router/RouterModule | 2,227 | 0.69
[x] |router/Route | 2,223 | 0.69 [x] |router/Route | 2,223 | 0.69
[x] |common/http/HttpClientModule | 2,167 | 0.67 [x] |common/http/HttpClientModule | 2,167 | 0.67
[ ] |core/ElementRef | 2,163 | 0.67 [x] |core/ElementRef | 2,163 | 0.67
[ ] |core/OnInit | 2,136 | 0.66 [ ] |core/OnInit | 2,136 | 0.66
[ ] |common/UpperCasePipe | 2,078 | 0.65 [ ] |common/UpperCasePipe | 2,078 | 0.65
[ ] |common/NgStyle | 1,935 | 0.60 [ ] |common/NgStyle | 1,935 | 0.60

View File

@ -9,13 +9,18 @@
/** /**
* A wrapper around a native element inside of a View. * A wrapper around a native element inside of a View.
* *
*
*
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
* element. * element.
* *
* `ElementRef` DOM
*
* @security Permitting direct access to the DOM can make your application more vulnerable to * @security Permitting direct access to the DOM can make your application more vulnerable to
* XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
* [Security Guide](http://g.co/ng/security). * [Security Guide](http://g.co/ng/security).
* *
* 访 DOM XSS `ElementRef` [](http://g.co/ng/security)。
* *
*/ */
// Note: We don't expose things like `Injector`, `ViewContainer`, ... here, // Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
@ -26,8 +31,11 @@ export class ElementRef<T = any> {
* The underlying native element or `null` if direct access to native elements is not supported * The underlying native element or `null` if direct access to native elements is not supported
* (e.g. when the application runs in a web worker). * (e.g. when the application runs in a web worker).
* *
* 访 `null` Web Worker
*
* <div class="callout is-critical"> * <div class="callout is-critical">
* <header>Use with caution</header> * <header>Use with caution</header>
* <header></header>
* <p> * <p>
* Use this API as the last resort when direct access to DOM is needed. Use templating and * Use this API as the last resort when direct access to DOM is needed. Use templating and
* data-binding provided by Angular instead. Alternatively you can take a look at {@link * data-binding provided by Angular instead. Alternatively you can take a look at {@link
@ -36,10 +44,17 @@ export class ElementRef<T = any> {
* supported. * supported.
* </p> * </p>
* <p> * <p>
* 访 DOM API 使 Angular {@link
* Renderer2}使 API 使访
* </p>
* <p>
* Relying on direct DOM access creates tight coupling between your application and rendering * Relying on direct DOM access creates tight coupling between your application and rendering
* layers which will make it impossible to separate the two and deploy your application into a * layers which will make it impossible to separate the two and deploy your application into a
* web worker. * web worker.
* </p> * </p>
* <p>
* 访 DOM Web Worker
* </p>
* </div> * </div>
* *
*/ */