AngularJS:单选按钮不与引导工作3 [英] AngularJS: Radio buttons do not work with Bootstrap 3

查看:176
本文介绍了AngularJS:单选按钮不与引导工作3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个单选按钮,这台的值为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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆