我的代码:
<li class="grid--col2of10" ng-repeat="button in buttons">
<button ng-show="button.show" class="btn--action-{{button.color}} icon-{{button.icon}}" ng-click="{button.clickAction}">{{button.text}}</button>
</li>
我的对象:
var btns = {
"back": {
"color": "red",
"clickAction": "prevStep",
"icon": "left",
"text": "Back"
},
"cancel": {
"color": "red",
"icon": "block",
"text": "Cancel"
},
"clear": {
"color": "blue",
"icon": "cancel",
"text": "Clear"
},
"save": {
"color": "green",
"icon": "download",
"text": "Save"
},
"next": {
"color": "green",
"clickAction": "nextStep",
"icon": "right-after",
"text": "Save and Continue"
}
};
是否可以创建button.clickAction
一个在 AngularJS 中执行的函数?
btns 对象在指令内,使用指令templateUrl
选项调用 html。