Solved

$scope does not have value

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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 …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
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)

746 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

10 Experts available now in Live!

Get 1:1 Help Now