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

x
?
Solved

$scope does not have value

Posted on 2013-11-25
2
Medium Priority
?
304 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
2 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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 …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

927 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