尝试使用$ http.get()方法在角度js中实现rest调用并传递多个参数但是它正在抛出 错误
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");
});
错误是:
org.xml.sax.SAXParseException; lineNumber: 364; columnNumber: 85; The reference to entity "api_secret" must end with the ';' delimiter.
任何可能的解决方法?
答案 0 :(得分:1)
您好,您可以尝试以下操作,我离开电脑,所以无法尝试建议。
var obj = { API_KEY = 56a9bn1af, api_secret = d3n0de241, 数= 919690286358, 品牌= “stayuncle” };
$ http.get(“https://api.nexmo.com/verify/json?param=”+ json.stringfy(obj));
从检查API,我认为你必须尝试这个 -
"https://api.nexmo.com/verify/json?api_key={api_key}&api_secret={api_secret}&number=447525856424&brand=MyApp"