Assign Value on Textbox Input


#1

Hi Ionic Developers,

Do anyone here has an idea on how to assign values in an input?

<input type="text" placeholder="Last Name">

I tried ng-model and ng-value, non of these worked. I am not sure if I have doing the right coding.

Thanks.


#2

ng-model will work, you just need to use dot notation, like this:

 <input type="search" placeholder="Search" ng-model="movie.name" ng-change="searchMovieDB()">

#3

Hi @Gajotres,

Do I need to use ng-repeat?

Here’s my code:

 <ion-slide class="text-left" ng-repeat="data in jsonDataDetails">
            <div class="box">
               <div class="list">
                  <ul class="list">
                     <div>
                        <div class="list">
                            <div class="item item-positive item-header">
                                PATIENT PROFILE {{data.id}}
                              </div>
                              <div class="item item-divider">
                                 Patient Name
                              </div>
                              <label class="item item-input">
                                 <p>{{lastname}}</p>
                              <input type="text" placeholder="Last Name" ng-model="data.lastname">
                              </label>
                              <label class="item item-input">
                              <input type="text" placeholder="First Name" ng-model="data.FirstName">
                              </label>
                              <label class="item item-input">
                              <input type="text" placeholder="Middle Name" ng-model="data.MiddleName">
                              </label>
..
..
..

Thanks.


#4

Sorry but what does ng-repeat have to do with this question?