1
我的代碼:執行功能從變量稱爲AngularJS
<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。