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

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -