i new angularjs, , have come on issue passing variables function in controller. here code in html page:
<li ng-repeat="grade in grades"> <span class="status-{{grade.status()}}" ng-hide="visible" focus="visible = true" blur="visible = false" ng-click="visible = true">{{grade.name}},</span> <span class="status-{{grade.status()}}" ng-hide="visible" focus="visible = true" blur="visible = false" ng-click="visible = true">{{grade.score}}</span> <form ng-model="studentupdform" ng-submit="update({{grade.name}}, {{studentnamenew}}, {{grade.score}}, {{studentgradenew}})" focus="visible = true" blur="visible = false" ng-show="visible"> <input type="text" ng-model="studentnamenew" size="12" class="status-{{grade.status()}}" placeholder="{{grade.name}}" value="{{grade.name}}">, <input type="text" ng-model="studentgradenew" size="2" class="status-{{grade.status()}}" placeholder="{{grade.score}}" value="{{grade.score}}"> <input class="btn-primary" type="submit" value="update"> </form> </li>
here function form points to:
$scope.update = function(thisname, newname, thisscore, newscore) { //run code };
what it's supposed do: allow inline editing of list item, generated array "grades", each item being "grade". here's i'm running trouble: in calling function $scope.update, values thisscore , newscore passed in fine variables {{grade.score}} , {{studentgradenew}}. however, values i've trying pass through thisname , newname not. when send arguments passed in console, this:
undefined undefined 98 88
i've been digging around see why old , new names not passing over, @ loss. it's odd me since old , new score variables passing successfully, , declared in relation form same way names. must missing something, can't think of what.
try removing {{}} in function call. aren't required. not sure why still find of vars , not others, in plunker when removed them, things started working.
Comments
Post a Comment