javascript - Why ng-click not working in a dynamic html content? -


i have web application working angular js , has selection select master data. working fine. problem create dynamic button inside table , have attached ng-click method button, however, not working , not give kind of respone either.

ng-click='ssa' call , $scopr.ssa = function(){} has alert method method called or not

myapp.controller('oppcontroller', ['$scope', function ($scope) {          $scope.masterselection = [{ id: 1, name: 'contact' }, { id: 2, name: 'property category' }, { id: 3, name: 'property features' }, { id: 4, name: 'sale or rent' }];          $scope.masterchange = function () {              var type = $scope.master.name;             var value = $scope.newtype;              var master = new dataadd(type, value);              $.ajax({                 url: "../api/operations/mastertables",                 type: 'post',                 contenttype: 'application/json',                 data: json.stringify({                     master: master                 }),                 success: function (data) {                     setdp(data);                 },                 error: function (jqxhr, exception) {                     alert(exception);                  }             });             $scope.experror = "sdsd";         }            $scope.ssa = function () { alert('qw');}      function setdp(data) {         var tables = '<table width="60%"><col width="15%"/><col width="20%"/><col width="65%"/><tbody>';          if (data != null) {             (var = 0; < data.length; i++) {                 tables += '<tr>';                 tables += '<td> <img style="width:40px; height:40px;" src=@url.content("~/content/images/btndelete.png") /> </td>';                 tables += '<td> <label style="font-size:x-small; color:white;">' + (i + 1) + '</label> </td>';                 tables += '<td> <label style="font-size:x-small; color:white;">' + data[i][1] + '</label> </td>';                 tables += '</tr>';             }         }          tables += '<tr><td> <button style="width:80px; height:30px; font-size:15px;" ng-click="ssa();"> add </button> </td><td></td>';         tables += '<td> <input style="font-size:20px; width:100%;"  type="text" ng-model="newtype" /></td></tr>';         tables += '</tbody></table>';          $("#dvtable").html(tables);      }          function dataadd(type, value) {             this.type = type;             this.value = value;         }     }]); 

following html code

<select ng-model="master" ng-options="master.name master in masterselection" ng-change="masterchange()">       <option value="">none</option>     </select>       <div ng-bind-html="dvtable">        </div> 

how should make button clickable in angular js application? in advance

<select ng-model="master" ng-options="master.name master in masterselection" ng-change="masterchange()">       <option value="">none</option> </select>  <my-table>  </my-table> 

//js

(function(){  myapp.directive('mytable', function(){   return {   restrict : 'e',   templateurl : 'my-table.template.html',   link : function(scope){     scope.ssa = function(){       alert("hello");     }   }    };  });   })(); 

//my-table.template.html

<div> <button class="btn btn-default ng-click="ssa()"> click </button> </div> 

Comments