satya
satya

Reputation: 3560

Can not bind data inside input field using angular.js

I have two input filed and those are given below.

<input type="text" name="itemname" id="contactno" class="form-control" placeholder="short name" ng-model="dept_short_name" >
<input type="text" name="itemname" id="contactno" class="form-control" ng-model="loginname" readonly="readonly" value="{{dept_short_name}}" >

I need when user will type any text in first input field the second input field will update with same data simultaneously.Please help me.

Upvotes: 1

Views: 55

Answers (3)

xxlali
xxlali

Reputation: 1036

In controller watch dept_short_name and change loginname as you want inside watch.

Upvotes: 0

Ved
Ved

Reputation: 12093

It is simplest one task using angularjs. Check the fiddle link.

LINK:

FIDDLE

Upvotes: 1

Evgeni Dimitrov
Evgeni Dimitrov

Reputation: 22496

<input type="text" ng-model="dept_short_name" />
<input type="text" readonly="readonly" ng-model="dept_short_name"></input>

Upvotes: 2

Related Questions