聚合物芯-ajax在新的聚合物元素中表现异常
Polymer core-ajax behaves weird when in new polymer element
我把一个核心ajax元素在一个新的聚合物元素,但不是响应,我得到一个访问控制错误。当我在同一个url上单独使用index.html中的元素时,我得到一个常规的响应。知道为什么会这样吗?
聚合物元素:<link rel="import" href="components/polymer/polymer.html">
<link rel="import" href="components/core-ajax/core-ajax.html">
<polymer-element name="reddit-service" attributes="posts subreddit">
<template>
<style>
:host {
display: block;
}
</style>
<core-ajax
auto
url="http://reddit.com/.json"
on-core-response="{{ajaxResponse}}"
handleAs="json"></core-ajax>
</template>
<script>
Polymer('reddit-service', {
created: function() {
this.posts = [];
},
ajaxResponse: function(event, response) {
console.log(event);
}
});
</script>
</polymer-element>
index . html:
<!DOCTYPE html>
<html>
<head>
<!-- META AND STUFF -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Polymer Reddit App</title>
<!-- POLYMER -->
<script src="components/platform/platform.js"></script>
<link rel="import" href="components/core-ajax/core-ajax.html">
<link rel="import" href="components/core-header-panel/core-header-panel.html">
<link rel="import" href="components/core-toolbar/core-toolbar.html">
<link rel="import" href="reddit-list.html">
</head>
<body unresolved>
<core-toolbar>Reddit with Polymer</core-toolbar>
<core-ajax
auto
url="http://www.reddit.com/.json"
handleAs="json"></core-ajax>
<script>
function handle(event, response) {
console.log(event);
}
document.addEventListener('core-response', handle, false);
</script>
</body>
</html>
在您的自定义元素中,您缺少www
子域,这似乎是它正确工作所必需的。
相关文章:
- 用于搜索的聚合物嵌套绑定
- 聚合物0.5.5:核心列表中的条件模板和/或模板动态参考
- 在javaservlet doPost方法中启动线程时,无法返回异常消息
- Rubaxa可与聚合物进行排序/拖放不起作用,具体取决于显示器:
- document.applet.method在Mounatin Lion上抛出safari 6+JDK7异常
- 如何在模板聚合物中使用元素函数
- 聚合物dom重复问题
- 为什么浏览器没有为语法错误抛出异常
- java,javascript签名的小程序(文件选择,ftp上传)安全性/套接字异常
- node.js和express中的异常处理
- 聚合物是一个框架而不是一个库.如何模块化地使用web组件
- 派生进程的stdout在管道传输时工作异常
- NodeJS和pg promise,捕获PostgreSQL异常
- 当显式定义控制器参数时,默认模型绑定器会发生异常
- 显示引导弹出操作异常的逻辑
- 调用谷歌地图路线服务时未捕获的异常
- web配置http到https重定向异常
- 转换异常时间&Datestring到JavaScript日期
- 为什么在python中使用异常比javascript更容易接受
- 聚合物芯-ajax在新的聚合物元素中表现异常