zoukankan      html  css  js  c++  java
  • angular : ngModel 内部流程

    angular 1.5 beta link

    NgModelController provides API for the ngModel directive. The controller contains services for data-binding, validation, CSS updates, and value formatting and parsing. It purposefully does not contain any logic which deals with DOM rendering or listening to DOM events. Such DOM related logic should be provided by other directives which make use of NgModelController for data-binding to control elements. Angular provides this DOM logic for most input elements. At the end of this page you can find a custom control example that uses ngModelController to bind to contenteditable elements.

    NgModelController 为NgModel指令提供了API。控制器服务有data-binding,验证,css更新和value 格式化和解析。主要目的是不涉及Dom 渲染和监听Dom事件。Dom的关联逻辑应该由指令提供,内部由NgModelController负责data-binding。Angular 提供了Dom的逻辑大部分是为了Input element。剩下没必要翻译

    $render();

    渲染Dom!

    视图需要更新时调用。$rollbackViewValue()被调用。

    NgModel不做了深监听,只有$modelValue和$viewValue的值不一样时才会执行当之前的value有变化。如果$modelValue和$viewValue是对象将不会调用

    $isEmpty(value);

    这被调用当我们需要确定是否输入的值是空的。

    required 指令将调用这功能,过滤undefined''null or NaN.

  • 相关阅读:
    Linux临时增加swap空间
    Build RPM package from source code
    svn installation
    svn merge详解
    VMware DRS概述及功能
    VMware Fault Tolerance 概述及功能
    VMware HA 特性
    VMware Storage VMotion概述及功能
    Windows1小时后关机命令
    WINDOWS2008 KMS 服务器安装及激活
  • 原文地址:https://www.cnblogs.com/stooges/p/4900765.html
Copyright © 2011-2022 走看看