angularjs - Ng-click is not working with ng-bind-html in ng-repeat -


i'm trying data using jsonresult , angularjs in mvc4.

jsonresult function in controller:

public jsonresult getquestionsets() { //... var selecteddata = titles.select(y => new {     //...     qsaction = y.qtconfirm.equals(false) ? "<button type='button' class='btn btn-warning btn-sm' ng-click='getqsetid(qset.qstitleid)'>edit</button>" : y.questions.all(z => z.qstatus == null) ? "<button type='button' class='btn btn-success btn-sm disabled'>waiting</button>" : y.questions.all(z => z.qstatus == true) ? "<button class='btn btn-success btn-sm'>preview</button>" : "<button type='button' class='btn btn-warning btn-sm'>edit</button>", });  return json(selecteddata, jsonrequestbehavior.allowget);  } 

angularjs result:

$http.get('/tutor/getquestionsets').then(function (response) { $scope.questionsets = response.data; }); $scope.trustedhtml = $sce.trustashtml;// convert string html 

view:

<table class="table table-striped"> <thead>     //... </thead> <tbody>     <tr ng-repeat="qset in questionsets">         //...         <td align="center" ng-bind-html="trustedhtml(qset.qsaction)"></td>     </tr> </tbody> </table> 

my question is:

ng-click coming through json result <button type='button' class='btn btn-warning btn-sm' ng-click='getqsetid(qset.qstitleid)'></button> not working. when change ng-click onclick simple function working. know why , solution?

the ng-bind-html deals pure dom , not angular directives ng-click. angular has no idea include ngclick digest cycle , therefore listen on events. need $compile 1st. or use angular-bind-html-compile both things in 1 place


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -