html AngularJS切换切换从单选按钮隐藏/显示div

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html AngularJS切换切换从单选按钮隐藏/显示div相关的知识,希望对你有一定的参考价值。

<div class="form-group">
                <label for="exampleInputEmail1">ii. Select CMC</label>
                <div class="radio">
                  <label>
                    <input type="radio" name="select_cmc" ng-model="vm.formData.cmc" value="localcmc" >
                    Local CMC
                  </label>
                </div>
                <div class="radio">
                  <label>
                    <input type="radio" name="select_cmc" ng-model="vm.formData.cmc" value="foreigncmc" >
                    Foreign CMC
                  </label>
                </div>
</div>

<div ng-switch on="vm.formData.cmc">

                <!-- start of local cct -->

                <div ng-switch-when="localcmc">
                    <h3>Local CCT</h3>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">Criteria</p>
                        </div>
                        <div class="col-xs-12 col-md-5">
                            <p>Remarks <span class="required">*</span> (Must not exceed 255 chars)</p>
                        </div>
                    </div>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">Investments</p>
                        </div>
                        <div class="col-xs-12 col-md-7">
                            <textarea class="form-control" rows="8" ng-model="vm.formData.localcct_investment"></textarea>
                        </div>
                    </div>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">Must have IP development in their business model <input type="checkbox" ng-model="vm.formData.localcct_musthave_ipdevelopment"></p>
                        </div>
                        <div class="col-xs-12 col-md-7">
                            <textarea class="form-control" rows="8" ng-model="vm.formData.localcct_ipdevelopment" ng-readonly="!vm.formData.localcct_musthave_ipdevelopment" ></textarea>
                        </div>
                    </div>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">High value jobs</p>
                        </div>
                        <div class="col-xs-12 col-md-7">
                            <textarea class="form-control" rows="8" ng-model="vm.formData.localcct_highvalue_job"></textarea>
                        </div>
                    </div>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">% of revenue from exports</p>
                        </div>
                        <div class="col-xs-12 col-md-7">
                            <textarea class="form-control" rows="8" ng-model="vm.formData.localcct_revenue_percentage_export"></textarea>
                        </div>
                    </div>
                    
                </div>

                <!-- end of local cct -->

                <!-- start of foreign cct -->

                <div ng-switch-when="foreigncmc">
                    <h3>Foreign CCT</h3>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">Criteria</p>
                        </div>
                        <div class="col-xs-12 col-md-5">
                            <p>Remarks <span class="required">*</span> (Must not exceed 255 chars)</p>
                        </div>
                    </div>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">Investments (Minimum RM 5 million)</p>
                        </div>
                        <div class="col-xs-12 col-md-7">
                            <textarea class="form-control" rows="8" ng-model="vm.formData.foreigncct_investment"></textarea>
                        </div>
                    </div>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">Must have IP development in their business model <input type="checkbox" ng-model="vm.formData.foreigncct_musthave_ipdevelopment"></p>
                        </div>
                        <div class="col-xs-12 col-md-7">
                            <textarea class="form-control" rows="8" ng-model="vm.formData.foreigncct_ipdevelopment" ng-readonly="!vm.formData.foreigncct_musthave_ipdevelopment" ></textarea>
                        </div>
                    </div>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">High value jobs (Minimum 20 high value jobs)</p>
                        </div>
                        <div class="col-xs-12 col-md-7">
                            <textarea class="form-control" rows="8" ng-model="vm.formData.foreigncct_highvalue_job"></textarea>
                        </div>
                    </div>
                    <div class="row row-risk-factors">
                        <div class="col-xs-12 col-md-5">
                            <p style="padding-right: 5px">% of revenue from exports (Minimum 60% revenue from exports)</p>
                        </div>
                        <div class="col-xs-12 col-md-7">
                            <textarea class="form-control" rows="8" ng-model="vm.formData.foreigncct_revenue_percentage_export"></textarea>
                        </div>
                    </div>
                </div>

                <!-- end of foreign cct -->
                
</div>

以上是关于html AngularJS切换切换从单选按钮隐藏/显示div的主要内容,如果未能解决你的问题,请参考以下文章

使用单选按钮的嵌套问题切换

AngularJS - 用作单选按钮的 3 按钮组

通过单击标签来切换 HTML 单选按钮

在选择最后一个按钮之前,AngularJS 单选按钮未标记为 $dirty

从单选按钮输入单击时显示模式

从单选按钮获取文本[重复]