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
Solved

$scope does not have value

Posted on 2013-11-25
2
298 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:charlesbaldo
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:charlesbaldo
ID: 39676641
Thank You
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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 basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

808 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