[AngularJS] Use ng-model-options to limit $digest

Refer: http://toddmotto.com/super-fast-angular-ng-model-options-limit-digest-cycles/

 

Use:

<input 
  type="text" 
  ng-model="test"
  ng-model-options="{
    'updateOn': 'default blur',
    'debounce': {
      'default': 250,
      'blur': 0
    }
  }">

 

With Angular Formly:

Refer: http://angular-formly.com/#/example/field-options/model-options

 

Use:

{
        key: 'text',
        type: 'input',
        modelOptions: {
          debounce: {
            default: 2000,
            blur: 0
          },
          updateOn: 'default blur'
        },
        templateOptions: {
          label: 'Debounce',
          placeholder: 'update on blur and default'
        }
      },

 

posted @ 2015-11-14 23:28  Zhentiw  阅读(257)  评论(0编辑  收藏  举报