krishna krishna - 4 years ago 97
AngularJS Question

AngularJS Factory call to PHP then response back to AngularJS

I'am not able to find the mistake. my php file returning data like ["9963648941","7416527247"], and i'am using angular factory to get the data using http call as below

app.factory("States", function ($http){
var mData = {
getStates: function(){
return $http.get('php/usersList.php')
return mData;

The States factory is using in the controller as follows

app.controller('orderFormController', function($scope,$location,$rootScope,$http,States)

Finally i'am getting error as States.getStates.then is not a function in the controller.

Sai Sai
Answer Source

Here, you call the function as:


You missed the function call brackets.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download