0

I'm following line which makes the call to controller function i.e demoMethod.

document.getElementById("FileDisplay").innerHTML += "<span onclick=\"$(#control).demoMethod()\"></span>"+children[i]+"</br>";`

and demoMethod is declared inside the controller

$scope.demoMethod = function(){
        console.log("it works");
     }

and FileDisplay is the id of div in HTML file, how can I call this method inside from span element..?

Thank you

fool-dev
  • 7,671
  • 9
  • 40
  • 54

1 Answers1

3

Don't call your function with jQuery.

Use AngularJS ng-click, it's simpler:

<span ng-click="demoMethod()"></span>
Aleksey Solovey
  • 4,153
  • 3
  • 15
  • 34
Léo R.
  • 2,620
  • 1
  • 10
  • 22