Solved

$scope does not have value

Posted on 2013-11-25
2
300 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
This article discusses how to implement server side field validation and display customized error messages to the client.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

734 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