1

In jQuery we can get append an event after append html:

$('ul').delegate('a','click',function() {
    // your code here ...
});

Or we can:

$(document).on('click','ul li a', function(){
       // your code here ..
});

How can we do it in AngularJS after append html?

<div ng-bind-html="getSomehtml(l)"></div>
$scope.getSomehtml= function (l) {
    let namepath = 'a/b/c';
    let t = namepath.split('/').map(function (text, i) {
        return '<span  ng-click="changeNamePath(' + i + ',' + namepath+')"' + i + '>' + text + '</span>';
    }).join('/');
    return t;
};
georgeawg
  • 48,608
  • 13
  • 72
  • 95
Hong Van Vit
  • 2,884
  • 3
  • 18
  • 43
  • Does this answer your question? [angulajs-ng-click-in-expression-html](https://stackoverflow.com/questions/40542199/angulajs-ng-click-in-expression-html) – Rajesh Dec 09 '19 at 06:46
  • 1
    @Rajesh Thanks, but my case namepath there is alot of row load from db. I hope have a best solution for it. – Hong Van Vit Dec 09 '19 at 06:56

0 Answers0