相关疑难解决方法(0)

如何使用聚合物将HTML注入模板

我正在使用polymer-jsonp来执行JSONP请求,但响应有时包含html.

例如,假设post.content是"<strong>Foo</strong> bar",我如何"Foo"以粗体显示{{post.content}} ?

<polymer-element name="feed-element" attributes="">
  <template>
    <template repeat="{{post in posts.feed.entry}}">
      <p>{{post.content}}</p>
    </template>
    <polymer-jsonp url="url" response="{{posts}}"></polymer-jsonp>
  </template>
  <script>
    Polymer('feed-element', {
      created: function() { },
      attached: function() { },
      detached: function() { },
      attributeChanged: function(attrName, oldVal, newVal) { }
    });
  </script>
</polymer-element>
Run Code Online (Sandbox Code Playgroud)

javascript json polymer

14
推荐指数
2
解决办法
1万
查看次数

标签 统计

javascript ×1

json ×1

polymer ×1