如何从angularjs中基于查询的REST API URL获取数据? [英] How to fetch data from a query based REST API URL in angularjs?
问题描述
我想使用AngularJS(1)从REST API获取数据。 URL是|:href =http://wealthyfox.in:82//api/Test/GetTestSymbols?exchanges=nc&callTypes=eq&symbolLike=infra
我尝试过:
Index.html
<!doctype html>
< title> AngularJS
< br $>
ID为{{datafromapi.Symbol}}
内容为{{datafromapi.CompanyName}}
App.js :
angular.module(' app',[])
.controller('myApp',function($ scope,$ http){
$ http.get('http:// wealthyfox。 in:82 // api / Test / GetTestSymbols?deals = nc& callTypes = eq& symbolLike = infra')。
then(funct离子(响应){
$ scope.datafromapi = response.data;
});
});
范围,
http){
http.get('http:/ /wealthyfox.in:82//api/Test/GetTestSymbols?exchanges=nc&callTypes=eq&symbolLike=infra')。
then(function(response){
I want to fetch data from a REST API using AngularJS (1). The URL is |: href="http://wealthyfox.in:82//api/Test/GetTestSymbols?exchanges=nc&callTypes=eq&symbolLike=infra
What I have tried:
Index.html
<!doctype html>
<title>AngularJS
The ID is {{datafromapi.Symbol}}
The content is {{datafromapi.CompanyName}}
App.js :
angular.module('app', [])
.controller('myApp', function($scope, $http) {
$http.get('http://wealthyfox.in:82//api/Test/GetTestSymbols?exchanges=nc&callTypes=eq&symbolLike=infra').
then(function(response) {
$scope.datafromapi = response.data;
});
});
scope,
http) {
http.get('http://wealthyfox.in:82//api/Test/GetTestSymbols?exchanges=nc&callTypes=eq&symbolLike=infra').
then(function(response) {
这篇关于如何从angularjs中基于查询的REST API URL获取数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!