angularjs - Angular UI bootstrap modal, ng-click entry argument is undefined -
hello using angular ui bootsrap modal. , have multiple buttons on there, using 1 single method in ng-click, different input argument. problem in controller side, input argument undefined
here part of code: modal controller:
controller('mymodalcontroller', [ '$scope', '$modalinstance', function ($scope, $modalinstance) { $scope.keypressed = function (key) { console.log(key); }; $scope.close = function () { $modalinstance.dismiss('cancel'); }; } ])
and template using modal:
<tr> <td ng-click="keypressed(1)"><span>1</span></td> <td ng-click="keypressed(2)"><span>2</span></td> <td ng-click="keypressed(3)"><span>3</span></td> <td ng-click="keypressed(4)"><span>4</span></td> <td ng-click="keypressed(5)"><span>5</span></td> </tr>
if number pass method sample of want pass function, have bind way:
<td ng-click="keypressed(1)"><span>{{1}}</span></td>
Comments
Post a Comment