View source Improve this doc

NgModelController
type in module ng

Description

NgModelController provides API for the ng-model 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.

Custom Control Example

This example shows how to use NgModelController with a custom control to achieve data-binding. Notice how different directives (contenteditable, ng-model, and required) collaborate together to achieve the desired result.

Note that contenteditable is an HTML5 attribute, which tells the browser to let the element contents be edited in place by the user. This will not work on older browsers.

Source









Demo

Methods

Properties