angularjs - Unable to set scope variable within success function of http service -
I have an http service, where the attempt is made to save the result in a scope variable, but on the debugger variable Returns does not exist.
Here is the code.
... $ scope.valueList = []; $ Scope.getValues = function () {$ http ({url: '/ restservice / values /', method: 'post', data: this.json_data, header: {'Content-type': 'application / json '}}. Success (job, data, status, header, config) {this.valueList = data;}). Error (function (data, position, header, config) {console.log ("failed");}); } ...
this.valueList = data; should be
$ scope.valueList = data; Angle is still javascript, so the this reference area is still applicable. Also, this is not equal in this case $ Range .
Comments
Post a Comment