如何从angularjs中基于查询的REST API URL获取数据? [英] How to fetch data from a query based REST API URL in angularjs?

查看:93
本文介绍了如何从angularjs中基于查询的REST API URL获取数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆