Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

dart - How can I bind a text which contains url as html

How can I bind a text which contains url as html. Is it possible by using the following code ?

@CustomTag('my-element')
class MyElement extends PolymerElement {      
  @observable String text = "Bla bla bla '<a href="mysite.com">link</a>';"

  MyElement.created() : super.created();
}
<polymer-element name="my-element">
  <meta charset="utf-8">
  <template>
  <p>
   {{text}}
  </p>
  </template>
  <script type="application/dart" src="my_element.dart"></script>
</polymer-element>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Update

A ready-to-use element for Dart Polymer 1.0 is bwu-bind-html


No you can't bind html using mustache.

what you can do is

<a href="{{text}}">link</a>

with a field like

@observable String text = "mysite.com";

or use something like a <safe-html> tag - see HTML Tags Within Internationalized Strings In Polymer.dart


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...