0
我从json返回函数作为字符串。是否可以在ng-click中调用函数字符串?
JSON类似于以下内容。
menu:[
{action:"setItem()", p1:"{{this}}", text:"Add Item"},
{action:"removeItem()", p1:"{{this}}", text:"Remove Item"}
]
<div ng-repeat="menuList in menu">
<a href="#" ng-click="menu.action">{{menu.text}}</a>
</div>
我怎么能通过点击调用函数,即调用setItem()wheng点击添加项目。