Angular html property的值如何被更新的
生活随笔
收集整理的這篇文章主要介紹了
Angular html property的值如何被更新的
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
html頁面里有一個input element,通過語法[(ngModel)]雙向綁定到model hero的name字段。
一旦往input field里輸入新的值之后,觸發core.js的refreshView方法,里面執行templateFn方法:
hero-detail.component.html對應一個方法:HeroDetailComponent_div_2_Template:
上圖的方法負責更新element的property:
/*** @license* Copyright Google LLC All Rights Reserved.** Use of this source code is governed by an MIT-style license that can be* found in the LICENSE file at https://angular.io/license*/ /*** Update a property on a selected element.** Operates on the element selected by index via the {@link select} instruction.** If the property name also exists as an input property on one of the element's directives,* the component property will be set instead of the element property. This check must* be conducted at runtime so child components that add new `@Inputs` don't have to be re-compiled** @param propName Name of property. Because it is going to DOM, this is not subject to* renaming as part of minification.* @param value New value to write.* @param sanitizer An optional function used to sanitize the value.* @returns This function returns itself so that it may be chained* (e.g. `property('name', ctx.name)('title', ctx.title)`)** @codeGenApi*/el是html的原生element,即input field:
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
總結
以上是生活随笔為你收集整理的Angular html property的值如何被更新的的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 魔兽世界怀旧服奥金幼龙怎么获得 奥金幼龙
- 下一篇: Angulary应用依赖里的zone.j