Tuesday, 15 July 2014

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


I have consulted these related articles, but the solutions presented do not work:

Here's my plunker:

  & lt; Body ng-controller = "MainCtrl" & gt; & Lt; Table & gt; & Lt; Captions & gt; NG-troubles with repeat and ng-click & lt; / Caption & gt; & Lt; Thead & gt; & Lt; TR & gt; & Lt; Th & gt; Name & lt; / Th & gt; & Lt; Th & gt; Business & lt; / Th & gt; & Lt; / TR & gt; & Lt; / Thead & gt; & Lt; Tbody & gt; & Lt; Tr ng-repeat = "employee in employees" ng-click = "alert ('hi')" & gt; & Lt; TD & gt; {{Employee.name}} & lt; / TD & gt; & Lt; TD & gt; {{Employee.occupation}} & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt;  

  var app = angular Module ("plunker", []); App.controller ("MainCtrl", Function ($ scope) {$ scope.employees = [{Name: "John Doe", Occupation: "Miner"}, {name: "Theresa", Occupation: "Creating Worker"}] });  

This works, but not a part of alert It's your $ radius so it will not do anything.

You can add it to your controller:

  $ scope.alert = function (message) {warning (message); }  

No comments:

Post a Comment