Solved

AngularJS need default value in <input>

Posted on 2013-11-26
3
3,119 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:charlesbaldo
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 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:charlesbaldo
ID: 39678182
Thanks a ton
0
 

Expert Comment

by:maga lakshmi
ID: 41815365
hi
          maha
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now