Solved

$scope does not have value

Posted on 2013-11-25
2
299 Views
Last Modified: 2013-11-25
I am a newbie to AngularJS

I have a scope variable based on an ng-model in a repeater. When I perform an ng-click the $scope.  has no value.

The repeater

<tr ng-repeat="user in weeklyReportUsers">
...
...
...
      
      <td class="weeklyFirstName">
            <span ng-hide="editedItems[user.FirstName]">{{ user.FirstName }}</span>
            <span ng-show="editedItems[user.FirstName]">
                  <input class="form-control" type="text" ng-model="wklyFirstName" />
            </span>
      </td>
      ..
      ..
    ..
    ..      
The ng-click

<td class="weeklyEdit">
      <a href="#" ng-click="editWeeklyReport($event, user)"><img align="middle" style="width:10px;" src="/images/edit.png"></a>
      <div ng-show="editedItems[user.LastName]">
            <a href="#" ng-click="editWeeklyReportUpdate($event, user, currentListing)">Update</a>
      </div>
</td>      


----------------
Controller.js

$scope.editWeeklyReportUpdate = function ($event, user, currentListing) {

      $event.preventDefault();
      $event.stopPropagation();


      alert("\n FirstName " + $scope.wklyFirstName );   <--- HAS THE VALUE OF

                  user.FirstName  
                  NOT
                  ng-model="wklyFirstName"

Any Thoughts?
0
Comment
Question by:Charles Baldo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39676624
<input class="form-control" type="text" ng-model="user.wklyFirstName" />

and use :

alert("\n FirstName " + user.wklyFirstName );

Open in new window

0
 

Author Closing Comment

by:Charles Baldo
ID: 39676641
Thank You
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
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…

726 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