Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

AngularJS need default value in <input>

Posted on 2013-11-26
3
Medium Priority
?
4,221 Views
Last Modified: 2016-09-25
I am a newbie to AngularJS and JavaScript

I have two <span> tags that toggle on show and hide.  When the toggle goes to show for the input I need the value in {{ user.LastName }} to be the default value in the input.  I tried <input value='{{ user.LastName }}' .....> with no success

 <tr ng-repeat="user in weeklyReportUsers">
....
....
....
<td class="weeklyLastName">
      <span ng-hide="editedItems[user.LastName]">{{ user.LastName }}</span>
      <span ng-show="editedItems[user.LastName]">
            <input class="form-control" type="text" ng-model="user.wklyLastName" />
      </span>
</td>        
....
....
....
</tr>
0
Comment
Question by:Charles Baldo
3 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 39677629
What about :
<input class="form-control" type="text" ng-init="user.wklyLastName=user.LastName" ng-model="user.wklyLastName" />
0
 

Author Closing Comment

by:Charles Baldo
ID: 39678182
Thanks a ton
0
 

Expert Comment

by:maga lakshmi
ID: 41815365
hi
          maha
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

879 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question