angularjs - How to specify function name on $http.get status? -


i have angular function looks this.

function request($scope, $http) {       $http.get("http://www.w3schools.com/angular/customers.php")   .success(function (response) {      $scope.names = response.records;   }); } 

i replace anonymous function regular function rid of ugly indentation. not sure doing because have not success. basically, to this.

function request($scope, $http) {    processgoodstatus = function (response) {      $scope.names = response.records;   }    $http.get("http://www.w3schools.com/angular/customers.php")   .success(processgoodstatus); } 

how ? help.

you forget use var

declare

var processgoodstatus = function (response) {      $scope.names = response.records; } 

Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -