javascript - Angular JS Parameter is undefined -
hello having trouble when passing parameter function called addtohistory(param). when try write console says undefined, when try pass number gets correctly displayed on console.
$scope.addtohistory = function(title) { console.log(" " + title); //<-- undefined $scope.taskshistory.push({ info: title, measured: "measured", total: "total", done: 0, id: 2 }); }; <ion-item ng-repeat="task in taskscollection" ng-controller="historyctrl" ng-click="addtohistory({{task.info}})" href="#/app/history/{{task.id}}"> {{task.info}} <!-- <i class="icon ion-plus icon-right" ></i> --> </ion-item>
ng-click="addtohistory(task.info)"
remove brackets in function call
Comments
Post a Comment