I was seeing if there is a way to call a function I designed inside the scope.
我看到是否有办法调用我在范围内设计的函数。
<ul class="ui-listview ui-radiobutton" ng-repeat="meter in meters">
<li class = "ui-divider">
{{meter.DESCRIPTION}}
{{htmlgeneration}}
</li>
</ul>
$scope.htmlgeneration = function()
{
blah blah
}
The function is called htmlgeneration. Essentially what I want to do is dynamically append html inside the LI element while using angular.
该函数称为htmlgeneration。基本上我想要做的是在使用angular时在LI元素内动态附加html。
1 个解决方案
#1
21
Yep, just add parenthesis (calling the function). Make sure the function is in scope and actually returns something.
是的,只需添加括号(调用函数)。确保函数在范围内并实际返回一些内容。
<ul class="ui-listview ui-radiobutton" ng-repeat="meter in meters">
<li class = "ui-divider">
{{ meter.DESCRIPTION }}
{{ htmlgeneration() }}
</li>
</ul>
#1
21
Yep, just add parenthesis (calling the function). Make sure the function is in scope and actually returns something.
是的,只需添加括号(调用函数)。确保函数在范围内并实际返回一些内容。
<ul class="ui-listview ui-radiobutton" ng-repeat="meter in meters">
<li class = "ui-divider">
{{ meter.DESCRIPTION }}
{{ htmlgeneration() }}
</li>
</ul>