我需要在json国家列表中搜索.json就像:
[
{"name": "Afghanistan", "code": "AF"},
{"name": "Åland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"}
]
Run Code Online (Sandbox Code Playgroud)
我只从数据库中获取代码并输出整个名称.所以,如果我得到"AL",我想从json"阿尔巴尼亚"取回
嗨,我需要根据子属性过滤角度列表.
我有这个型号:
$scope.data = [{name:"John",type:{talent:"genius"}},
{name:"Paul",type:{talent:"genius"}},
{name:"Ringo",type:{talent:"lucky"}}];
Run Code Online (Sandbox Code Playgroud)
我需要显示一个只有人才的名单.所以我尝试这样的事情:
item in data|myFilter:item.type
Run Code Online (Sandbox Code Playgroud)
在angularJs中可以观察全局变量吗?
我从遗留代码中设置了一个window.test变量,然后我需要观察该变量以了解它是否存在.
我尝试过类似的东西
$window.$watch("test" , function(n,o){
//some code here...
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Jsoup解析html文档以获取所有标题标记.另外我需要将标题标签分组为[h1] [h2]等...
hh = doc.select("h[0-6]");
Run Code Online (Sandbox Code Playgroud)
但这给了我一个空阵列.
我想将json文件存储到我的amazon s3,然后使用ajax请求检索它.不幸的是,似乎s3不允许内容类型的应用程序/ json ....
我应该将文件保存为text/plain,然后用php添加标题?
嗨我有Jsoup的问题.
我刮了一页,得到了很多网址.他们有些是像相对URL: ,"../index.php"
,."../admin"
"../details.php"
我attr("abs:href")
用来获取绝对网址,但这个链接呈现为www.domain.com/../admin.php
我想知道这是不是一个bug.
有没有办法用jsoup获得真正的绝对路径?我该怎么解决这个问题?
我也尝试过absurl("href")
,但没有工作.
嗨,我需要根据子属性订购角度列表.
我有这个型号:
$scope.data = [{name:"John",type:{talent:"genius",val:99}},
{name:"Paul",type:{talent:"genius",val:89}},
{name:"Ringo",type:{talent:"lucky",val:29}}];
Run Code Online (Sandbox Code Playgroud)
我需要显示一个只有人才的名单.所以我尝试这样的事情:
item in data|orderBy:{type.val}
Run Code Online (Sandbox Code Playgroud)
我想基于他们的角色将我的用户重定向到不同的路线.我的应用程序中有两个安全区域,"admin"和"dashboard".我想检查用户是否经过身份验证,然后重定向到预期,但如果用户有角色编辑器,则应将其重定向到仪表板,否则如果他有角色,则应重定向到管理区域.
我在登录时使用了AuthenticatesAndRegistersUsers类.我在自定义控制器上有这个:
/**
* The default redirecTo path.
*
*/
protected $redirectTo = '/dashboard';
Run Code Online (Sandbox Code Playgroud)
因此,当用户通过身份验证时,它将被重定向到仪表板,但我想检查预期的URL是否在管理组路由上,如果用户具有管理员角色,则应将其重定向到管理区域.
我正在使用此中间件重定向到登录:
public function handle($request, Closure $next)
{
if ($this->auth->guest())
{
if ($request->ajax())
{
return response('Unauthorized.', 401);
}
else
{
return redirect()->guest('auth/login');
}
}
return $next($request);
}
Run Code Online (Sandbox Code Playgroud) 可以在angularjs中使用typeof吗?
我有一个ngrepeat循环我的数据,应该检查数据是字符串还是对象.
<tr ng-repeat="text in data">
<td>{{angular.isObject(text) && 'IsObject'||text}}</td>
</tr>
Run Code Online (Sandbox Code Playgroud) 我已经构建了一个提出多个请求的简单服务.该服务有两种方法.我无法在服务中调用另一个方法.
Plunkr:http://plnkr.co/edit/2fERik4uTxbxlVOhncMd?p =preview
app.factory('Report', ['$http', function($http){
var Authors = {
reports : [],
requests :[{'url':'data/data.cfm','response':'first'},
{'url':'data.json','response':'second'},
{'url':'data.json','response':'third'},
{'url':'data.json','response':'forth'}],
getReport : function(target, source, response, callback) {
return $http({ url:source,
method:"POST",
params:{url : target}
}).success(function(result) {
$scope.progress = response;
angular.extend($scope.user, result)
console.log($scope.user)
}
).error(function(error){
$scope.progress = response
})
},
startQueue : function (target) {
var promises = [];
this.requests.forEach(function (obj, i) {
console.log(obj.url)
promises.push(getReport(target, obj.url, obj.response, function(value){
reports.push(value);
console.log(value)
}));
});
$q.all(promises).then(function () {
console.log("Finito");
},function(error){
console.log("errori")
});
}
}; …
Run Code Online (Sandbox Code Playgroud)