javascript - ng-click on <tr> doing nothing -


i have consulted these related articles, presented solutions not work:

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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -