javascript - ng-click on <tr> doing nothing -
i have consulted these related articles, presented solutions not work:
- clickable bootstrap row angular
- adding parameter ng-click function inside ng-repeat doesn't seem work
- angular ng-click not working in div
here plunkr:: http://plnkr.co/edit/kha6makdbtry0xttc6wp?p=preview
<body ng-controller="mainctrl"> <table> <caption>troubles ng-repeat , ng-click</caption> <thead> <tr> <th>name</th> <th>occupation</th> </tr> </thead> <tbody> <tr ng-repeat="employee in employees" ng-click="alert('hi')"> <td>{{employee.name}}</td> <td>{{employee.occupation}}</td> </tr> </tbody> </table>
var app = angular.module("plunker", []); app.controller("mainctrl", function($scope) { $scope.employees = [ { name: "john doe", occupation: "miner" }, { name: "theressa", occupation: "construction worker" } ] });
it work, alert
not part of $scope
won't anything.
you can add in controller:
$scope.alert = function(message) { alert(message); }
Comments
Post a Comment