简体   繁体   中英

How to pass multiple argument in angular js rest call

Trying to implemnt rest call in angular js using $http.get() method and passing multiple parameter but it is throwing error

  var app = angular.module('angularjs-starter', []);


    app.controller('MainCtrl', function ($scope, $http) {


        $http.get("https://api.nexmo.com/verify/json?api_key=56a9bn1af&api_secret=d3n0de241&number=919690286358&brand=stayuncle");

    });

Error is :

org.xml.sax.SAXParseException; lineNumber: 364; columnNumber: 85; The reference to entity "api_secret" must end with the ';' delimiter.

Any possible work around?

Hi you can try the following, I'm away from a computer so can't try and suggest for sure.

var obj = { api_key=56a9bn1af, api_secret=d3n0de241, number=919690286358, brand="stayuncle" };

$http.get(" https://api.nexmo.com/verify/json?param= " + json.stringfy(obj));

From checking the API, I think you have to try this -

"https://api.nexmo.com/verify/json?api_key={api_key}&api_secret={api_secret}&number=447525856424&brand=MyApp"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM