0

I get HTML from AJAX and put it on page. This HTML has ng-click event, that does not work. Only after reload page. What is way does exist to resolve it?

vaved
  • 129
  • 1
  • 1
  • 12
  • 1
    Could you paste link relevant code and/or link to plunker ? – sol4me May 22 '15 at 19:20
  • All simple. There is HTML `
    ` that are returned from AJAX request in page.
    – vaved May 22 '15 at 19:25
  • How does the HTML end up on the page after a reload if it needs an AJAX request the first time? – Tyler May 22 '15 at 19:27
  • 1
    if you insert that as html have to use `$compile` – charlietfl May 22 '15 at 20:02
  • here's an SO discussion question/answer on [$compile and dynamic data](http://stackoverflow.com/questions/18157305/angularjs-compiling-dynamic-html-strings-from-database) that may be of help. – Shehryar Abbasi May 22 '15 at 20:23
  • Can you share one exmaple with `$compile`? – vaved May 22 '15 at 20:31
  • searching on SO is easy, just type something like `[angularjs] $compile ajax` (in the searchbox at the top of this page) and you will get some relevant posts. It is worthwhile to give something a try and post your code to SO for further questions/critique etc. Anyhow, for another example use of `$compile` you can also reference `@Chandermani's` approach here: [example of the usage of $compile in a Directive to load a data feed from Twitter](http://stackoverflow.com/a/17344875/4245493) GL! – Shehryar Abbasi May 22 '15 at 21:35

0 Answers0