</>
Skip to content
AngularJS lessons (12/28)

AngularJS — Input

Text Input

<input ng-model="user.name" type="text">
<p>Hello, {{user.name}}!</p>

Number Input

<input ng-model="age" type="number">
<p>Age: {{age}}</p>

Email Input

<input ng-model="email" type="email">
<p>Email: {{email}}</p>

Checkbox

<input type="checkbox" ng-model="agreed">
<p>Agreed: {{agreed}}</p>

Radio Buttons

<input type="radio" ng-model="color" value="red"> Red
<input type="radio" ng-model="color" value="blue"> Blue
<input type="radio" ng-model="color" value="green"> Green
<p>Selected: {{color}}</p>

Textarea

<textarea ng-model="message"></textarea>
<p>{{message}}</p>

Select

<select ng-model="selectedFruit">
  <option value="">Select Fruit</option>
  <option value="apple">Apple</option>
  <option value="banana">Banana</option>
  <option value="cherry">Cherry</option>
</select>
<p>Selected: {{selectedFruit}}</p>

ng-disabled

<input ng-model="name">
<button ng-disabled="!name">Submit</button>

Mini Practice

  1. Create different input types
  2. Bind values to model
  3. Use ng-disabled
  4. Create a select dropdown

Up Next

Continue with Validation — form validation.

Related Topics

Frequently Asked Questions about Input

What is Input in AngularJS?

Input is a fundamental concept in AngularJS. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Input?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Input.

Why is Input important in AngularJS?

Input is essential for AngularJS development. Understanding this concept will help you write better code and solve real-world problems more effectively.