Angularjs 角度:无法将变量值分配给href
我试图在一个有角度的网站上创建一个facebook共享按钮,但无法动态设置href属性 假设value=“abc”,问题归结如下Angularjs 角度:无法将变量值分配给href,angularjs,facebook,Angularjs,Facebook,我试图在一个有角度的网站上创建一个facebook共享按钮,但无法动态设置href属性 假设value=“abc”,问题归结如下 {{value}} 我认为原因在于价值动态地接受它的价值 如何将该值输入href属性?如果您尝试使用href=”https://www.facebook.com/sharer.php?title={{response.correct}}&u=http://example.com“?事实上,我认为href属性不是问题所在,因为我试过使用ng attr href和ng
{{value}}
我认为原因在于价值动态地接受它的价值
如何将该值输入href属性?如果您尝试使用
href=”https://www.facebook.com/sharer.php?title={{response.correct}}&u=http://example.com“
?事实上,我认为href
属性不是问题所在,因为我试过使用ng attr href
和ng href
这两种工具,你可以同时使用{{…}
如果你尝试使用href=”https://www.facebook.com/sharer.php?title={{response.correct}}&u=http://example.com“
?事实上,我认为href
属性不是问题所在,因为我试过使用ng attr href
和ng href
,并且您可以使用{{…}
<!-- language: lang-html -->
{{value}} <!-- ""-->
<span ng-bind="value"></span> <!-- "abc" -->
<a href="http://example.com/{{value}}">link1</a> <!-- href="http://example.com" -->
<a ng-href="http://example.com/{{value}}">link2</a> <!-- href="http://example.com" -->
<a ng-attr-href="http://example.com/{{value}}">link3</a> <!-- href="" -->