Reputation: 33
Hello is there someone who knows: How can I execute an AngularJs method from plain javascript. =) Thanks.!!
myApp.controller("someController",["$scope",function($scope){
//Some code was here
$scope.a = valueA;
$scope.b = valueB
});
and a bit later in the code want to execute a function that when valid could execute an IF and if thats the case will execute my AngularJS controller or what ever.
function Clicked(){
if( was clicked correctly ){
//execute my Controller and send some data to add to the DOM
}
Upvotes: 0
Views: 558
Reputation: 5401
Well, I don't think that's what you really want. Have a look at https://docs.angularjs.org/api/ng/directive/ngClick . You want your HTML elements to trigger a function inside your controller.
Upvotes: 2