Javascript 角度单选按钮单击显示和隐藏不工作

Javascript 角度单选按钮单击显示和隐藏不工作,javascript,html,angular,Javascript,Html,Angular,我是Angular的初学者,当我单击单选按钮show and hide div area时,尝试创建Angular 5。 ,我创建了customer-1和customer-2单选按钮,当我单击customer-2单选按钮时,它是否不工作(如第1部分所示),该单选按钮正常html工作正常,但对angular 5不工作, 有人知道如何正确地用Angular5来表达吗 谢谢 html × 注册 客户-1 客户-2 我同意条款和条件 注册 我同意条款和条件 注册 实现这一点的方法是将代码放在app.co

我是Angular的初学者,当我单击单选按钮show and hide div area时,尝试创建Angular 5。 ,我创建了customer-1和customer-2单选按钮,当我单击customer-2单选按钮时,它是否不工作(如第1部分所示),该单选按钮正常html工作正常,但对angular 5不工作, 有人知道如何正确地用Angular5来表达吗

谢谢

html

× 注册 客户-1 客户-2 我同意条款和条件 注册 我同意条款和条件 注册
实现这一点的方法是将代码放在app.component.ts中,而不是放在带有jquery选择器的脚本标记中

类中应该有两个成员变量,它们由component.ts-fil中的方法更改,并通过在HTML中单击绑定到该方法。要绑定到代码中的变量,请使用[attr]-语法


您可以在此处查看我的代码分支

先生谢谢您的回答,但这不是我的问题,您可以检查我的代码片段代码吗?我不知道您的问题是什么,您的代码片段似乎工作正常先生,单击此按钮,您可以理解它。它能用JS,但不能用Angular 5吗?我已经看过了。你看过我的链接了吗?我想我成功了,没问题,祝你好运!我建议您阅读angular.io中有关组件的文档
<div class="modal fade cust-my-modal cust-my-modal-2" id="signup_modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
        <h4 class="modal-title" id="myModalLabel">SIGN UP</h4>
      </div>
      <div class="modal-body">
        <div class="row">
          <div class="col-sm-12">
            <div class="top-radio">
              <div class="radio radio-primary">
                <input type="radio" name="radio1" id="radio1" onClick="changediv('nc_signup')" checked="checked" value="option1">
                <label for="radio1">
                 customers-1
                </label>
              </div>
              <div class="radio radio-primary">
                <input type="radio" name="radio1" id="radio2" onClick="changediv('cc_signup')" value="option2">
                <label for="radio2">
                 customers-2
                </label>
              </div>
            </div>
            <form class="fotm" id="cc_signup" style="display: none;" action="rfq.html">
              <div class="frm-btm-mrg">
                <div class="form-group">
                  <input class="form-control" placeholder="Email id" type="text">
                </div>
                <div class="form-group">
                  <input class="form-control" placeholder="Password"  type="password">
                </div>
                <div class="form-group">
                  <input class="form-control" placeholder="Re-enter password"  type="password">
                </div>

                <div class="form-group">
                  <input class="form-control" placeholder="Company name" type="text">
                </div>
                <div class="form-group">
                  <input class="form-control" placeholder="Website" type="text">
                </div>
                <div class="form-group">
                  <input class="form-control contact-num" placeholder="Contact number" type="text">
                </div>
                <div class="checkbox">
                  <input id="checkbox2" type="checkbox">
                  <label for="checkbox2">
                    I agree terms & conditions
                  </label>
                </div>
              </div>

              <button type="submit" class="btn">Sign up</button>
            </form>


            <form class="fotm" id="nc_signup" action="rfq.html">

              <div class="frm-btm-mrg-2">
                <div class="form-group">
                  <input class="form-control" placeholder="User name" type="text">
                </div>
                <div class="form-group">
                  <input class="form-control" placeholder="Email id" type="text">
                </div>
                <div class="form-group">
                  <input class="form-control" placeholder="Password"  type="password">
                </div>
                <div class="form-group">
                  <input class="form-control" placeholder="Re-enter password"  type="password">
                </div>
                <div class="checkbox">
                  <input id="checkbox3" type="checkbox">
                  <label for="checkbox3">
                    I agree terms & conditions
                  </label>
                </div>
              </div>

              <button type="submit" class="btn">Sign ups</button>
            </form>

          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>  
    function changediv(divid){
        $("#nc_signup").hide();
        $("#cc_signup").hide();
        $("#"+ divid).show();

    }
</script>