Skip to content
Advertisement

how do i send data to php from AngularJS controller?

I’m suffering a lot trying to do this, in words: Trying to send a token to a myfunction.php so it can do it’s job, then make it return 2 variables so I can use em in my Javascript controller (Made with angularJS).

So far i heard I should use $http, but I can’t understand how I should do this

enter image description here

Advertisement

Answer

create an angularjs service and use it in your controller. here is the service which can provide Create, read, write and delete functionality:

JavaScript

next add this service as a dependency to your controller and use it’s methods like this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement