---
title: "What is ng-model in AngularJS?"  
description: "What is ng-model in AngularJS?"  
author: "Ashutosh Patel"  
published: 2024-06-19  
updated: 2024-06-19  
canonical: https://www.mindstick.com/interview/33914/what-is-ng-model-in-angularjs  
category: "angular js"  
tags: ["javascript", "angular js", "angularjs model"]  
reading_time: 3 minutes  

---

# What is ng-model in AngularJS?

#### Angular js ng-model

The [`ng-model`](https://www.mindstick.com/interview/22956/what-is-difference-between-ng-model-and-ng-bind-in-angularjs) directive in AngularJS is used to bind the value of **HTML** controls (such as **input**, **select**, **textarea**) to application data. It is a **two-way data binding** between a control and a property defined in the AngularJS **controller** or **scope**.

Here is how the ng-model works,

**Binding Data-** Binds the value of HTML controls to application data. When the data in the controller or scope changes, the HTML control is automatically updated, and vice versa.

## Syntax-

Here is a simple syntax to demonstrate the ng-model in the HTML template,

```html
<input type="text" ng-model="propertyName">
```

\
**Two-way data binding-** `ng-model` for **two-way data binding**, ie. changing the input field updates the model in scope, and changing the scope model updates the input field removes this synchronization is automatic without requiring explicit event handling or DOM usage in a negative way.

**Usage-** In addition to `<input>`, `ng-model` can also be used with `<select>` and `<textarea>`, making it versatile for various user input controls.

**Validation-** `ng-model` also seamlessly integrates with AngularJS’s **form validation** features, allowing you to easily validate user input using AngularJS’s built-in validation directives

Overall, the `ng-model` simplifies the process of handling user input and manages the state of application data associated with that input in AngularJS applications.

**Also, Read:** [What are AngularJS key features?](https://www.mindstick.com/interview/33913/what-are-angularjs-key-features)

## Answers

### Answer by Ashutosh Patel

#### Angular js ng-model

The [`ng-model`](https://www.mindstick.com/interview/22956/what-is-difference-between-ng-model-and-ng-bind-in-angularjs) directive in AngularJS is used to bind the value of **HTML** controls (such as **input**, **select**, **textarea**) to application data. It is a **two-way data binding** between a control and a property defined in the AngularJS **controller** or **scope**.

Here is how the ng-model works,

**Binding Data-** Binds the value of HTML controls to application data. When the data in the controller or scope changes, the HTML control is automatically updated, and vice versa.

## Syntax-

Here is a simple syntax to demonstrate the ng-model in the HTML template,

```html
<input type="text" ng-model="propertyName">
```

\
**Two-way data binding-** `ng-model` for **two-way data binding**, ie. changing the input field updates the model in scope, and changing the scope model updates the input field removes this synchronization is automatic without requiring explicit event handling or DOM usage in a negative way.

**Usage-** In addition to `<input>`, `ng-model` can also be used with `<select>` and `<textarea>`, making it versatile for various user input controls.

**Validation-** `ng-model` also seamlessly integrates with AngularJS’s **form validation** features, allowing you to easily validate user input using AngularJS’s built-in validation directives

Overall, the `ng-model` simplifies the process of handling user input and manages the state of application data associated with that input in AngularJS applications.

**Also, Read:** [What are AngularJS key features?](https://www.mindstick.com/interview/33913/what-are-angularjs-key-features)


---

Original Source: https://www.mindstick.com/interview/33914/what-is-ng-model-in-angularjs

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
