0
我有四個不同的輸入,並且想要將更改的輸入的值發送到控制器,而無需按發送按鈕或其他。將ng-model的值發送到角度控制器
我如何得到它所有的輸入應該有下一個句法。
<input ng-model="borderRadius" ng-change="change()">
<input ng-model="background" ng-change="change()">
還是不是?
我想他們在我的app.js
control.controller('generatorOptions', function ($scope) {
$scope.buttonStyle = {
"border-radius" : " -- here is value of it -- ",
"background" : " -- here is value of it -- "
};
});
更新:這是工作得很好,但如何優化代碼? https://github.com/tanotify/Button-style-generator/blob/master/public/assets/scripts.min.js
'ng-model'已經創建了scope屬性,只是給每個'ng-model'分配了按鈕屬性。 – charlietfl 2014-08-30 21:13:20
這樣做是否正確? https://github.com/tanotify/Button-style-generator/blob/master/public/assets/scripts.min.js – Antoni 2014-08-30 21:56:49
這應該是原樣。你提供的鏈接......如果你在解釋每個代碼塊的預期內容時會更好......否則很難給出相關評論 – harishr 2014-08-31 05:39:16