问题描述
我有一个单选按钮,这台的值为True
或假基于事务类型的值
I have a radio button, which sets the value of True
or False
based on the value of transaction type
该演示可以发现
问题是,当我点击任何一个单选按钮,的 $ scope.transaction.debit
不改变值
The problem is when I click on any of the radio button, the value of $scope.transaction.debit
does not change
我的JavaScript code是
My javascript code is
var app = angular.module('myApp', []);
app.controller("MainCtrl", function($scope){
$scope.transaction = {};
$scope.transaction.debit=undefined;
console.log('controller initialized');
});
请让我知道我做错了。
另外,我不想使用角的UI
或 AngularStrap
为此目的,除非没有其他选择是可用的。
Also, I do not want to use Angular-UI
or AngularStrap
for this purpose, unless no other option is available.
推荐答案
您有一个大的标签贴在其上prevents输入您的单选按钮单选按钮的上方。
在HTML应该阅读:
You have a large label stuck over the top of the radio buttons which prevents input to your radio buttons.The html should read:
<input type="radio" data-ng-model="transaction.debit" value="True">Debit</input>
<input type="radio" data-ng-model="transaction.debit" value="False">Credit</input>
然后,它的工作原理,当然它可能不看你想要的方式它吧。
It then works, of course it may not look the way you want it to then.
这篇关于AngularJS:单选按钮不与引导工作3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!