我无法使用angular $ http服务来提供服务.我必须使用YQL进行JSON转换.是不是像jquery $ .ajax的$ http?这是我的代码:
function cfgFunction($routeProvider)
{
$routeProvider.
when("/",{templateUrl:"partials/table.html"})
}
function testctrl($scope, $http) {
var s = 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%20%3D%20%22http%3A%2F%2Fapp.mytrading.it%3A8080%2FTS%2Fvis_dati.AllQuotes%3Fp_profilo%3D%26p_indice%3D%26p_id_cliente%3D%26p_nazione%3D%26p_num%3D%26p_titolo%3D%22&format=json&callback=';
$http.get(s).success(function(data) {
$scope.titoli = data.query.results.ROWSET.ROW;
}).
error(function(data, status, headers, config) {
alert("error!")
});
}
angular.module('MytApp',[]).config(cfgFunction);
Run Code Online (Sandbox Code Playgroud) 我需要在随机字符串中替换和连接一些值,我将值存储在数组中.
即
$search = array('dog', 'tree', 'forest', 'grass');
$randomString = "A dog in a forest";
Run Code Online (Sandbox Code Playgroud)
如果一个或多个数组值与随机字符串匹配,那么我需要像这样的替换:
$replacedString = "A @dog in a @forest";
Run Code Online (Sandbox Code Playgroud)
有人能帮我吗?
谢谢.