Javascript ng包括不按预期工作

Javascript ng包括不按预期工作,javascript,angularjs,angularjs-ng-include,Javascript,Angularjs,Angularjs Ng Include,我有一个表单,它有几个按钮。单击此按钮之一时,此表单应删除并加载另一个表单。我正在尝试使用ng include方法来实现这一点。我以前也做过类似的事情,并且成功了。但我不明白为什么这不起作用 我已经给出了第二个表单内部脚本标签,当点击上面提到的按钮时,它会调用此表单。但它不加载 我已经在控制器中使用ng if方法删除了现有表单 我的html代码 <div class="container"> <form role="form" id="info_form" name=

我有一个表单,它有几个按钮。单击此按钮之一时,此表单应删除并加载另一个表单。我正在尝试使用ng include方法来实现这一点。我以前也做过类似的事情,并且成功了。但我不明白为什么这不起作用

我已经给出了第二个表单内部脚本标签,当点击上面提到的按钮时,它会调用此表单。但它不加载

我已经在控制器中使用ng if方法删除了现有表单

我的html代码

<div class="container">

    <form role="form" id="info_form" name="info_form" ng-controller="infoCtrl" ng-app="app"  novalidate>
        <div>

            <section class="content-header">
                <h1>
                    Fill your medical information
                    <!--<small>Optional description</small>-->
                </h1>
            </section>

            <!-- Main content -->
            <section class="content">
                <div>
                <div class="box">
                    <?php
                    echo form_open('info/addInfo');
                    ?>
                    <div class="box-body">
                        <div>
                            <div class="col-lg-12">

                                <div style="margin-top: 15px;width: 100%;">
                                    <!--first block-->
                                    <div style="float: left;width: 33%;height: 100%" ng-show="table_remove">


                                        <div class="form-group">
                                            <label class="info_ques_text">Age</label>
                                            <div class="input-group">
                                                <input class='input' type="number" class="form-control" name="Age" id="Age" ng-model="data.age" placeholder="Enter your age" required><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Age.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div>


                                        <div class="form-group">
                                            <label class="info_ques_text">Sex</label>
                                            <div class="input-group">
                                                <select class='input' name="Sex" id="Sex" ng-model="data.sex" ng-selected="" required>
                                                    <option value="" disabled selected>Select Your Option</option>
                                                    <option value="M">Male</option>
                                                    <option value="F">Female</option>
                                                </select><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Sex.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div>





                                        <div class="form-group">
                                            <label class="info_ques_text">Blood Pressure</label>
                                            <div class="input-group">

                                                <input class='input' type="number" class="form-control" name="Pressure" id="Pressure" ng-model="data.blood_pressure" placeholder="Enter your blood pressure" required><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Pressure.$error.required">Value cannot be blank</span>

                                            </div>
                                        </div>



                                        <div class="form-group">
                                            <label class="info_ques_text">Blood Sugar</label>
                                            <div class="input-group">
                                                <select class='input' name="Sugar" id="Sugar" ng-model="data.sugar" ng-selected="" required>
                                                    <option value="" disabled selected>Select Your Option</option>
                                                    <option value="PF">Low</option>
                                                    <option value="NPF">Normal</option>
                                                    <option value="C">High</option>
                                                </select><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Sugar.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div> 




                                        <div class="form-group">
                                            <label class="info_ques_text">Maximum Heart Rate</label>
                                            <div class="input-group">
                                                <input class='input' type="number" name="Heart" id="Heart" class="form-control"  ng-model="data.heart_rate" placeholder="Enter Value" required><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Heart.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div>
                                    </div>

                                    <!--second block-->




                                        <div class="form-group">
                                            <label class="info_ques_text">Slope The Peak Exercise ST Segment</label>
                                            <div class="input-group">
                                                <input class='input' type="number" name="Slope" id="Slope" class="form-control"  ng-model="data.slope" placeholder="Enter Value" required><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Slope.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div>


                                        <div class="form-group">
                                            <label class="info_ques_text">Number of major vessels</label>
                                            <div class="input-group">
                                                <select class='input' name="Vessel" id="Vessel" ng-model="data.vessels" ng-selected="" required>
                                                    <option value="" disabled selected>Select Your Option</option>
                                                    <option value="0" >0</option>
                                                    <option value="1">1</option>
                                                    <option value="2">2</option>
                                                    <option value="3">3</option>
                                                </select><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Vessel.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div>





                                        <div class="form-group">
                                            <label class="info_ques_text">Smoking</label>
                                            <div class="input-group">
                                                <select class='input' name="Smoke" id="Smoke" ng-model="data.smoking" ng-selected="" required>
                                                    <option value="" disabled selected>Select Your Option</option>
                                                    <option value="0">No</option>
                                                    <option value="1">Yes - Heavy Smoker</option>
                                                    <option value="2">Yes - Light Smoker</option>
                                                </select><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Smoke.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div>


                                        <div class="form-group">
                                            <label class="info_ques_text">Exercising</label>
                                            <div class="input-group">
                                                <select class='input' name="Exercise" id="Exercise" ng-model="data.exercise" ng-selected="" required>
                                                    <option value="" disabled selected>Select Your Option</option>
                                                    <option value="0">No</option>
                                                    <option value="1">Yes</option>
                                                </select><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Exercise.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div> 





                                    </div>

                                    <!--third block-->

                                    <div style="float: left;width: 34%;height: 100%" ng-show="table_remove">

                                        <div class="form-group">
                                            <label class="info_ques_text">Consuming Alcohol</label>
                                            <div class="input-group">
                                                <select class='input' name="Alcohol" id="Alcohol" ng-model="data.alcohol" ng-selected="" required>
                                                    <option value="" disabled selected>Select Your Option</option>
                                                    <option value="0">No</option>
                                                    <option value="1">Yes - Heavy Consumer</option>
                                                    <option value="2">Yes - Light Consumer</option>
                                                </select><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Alcohol.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div>  




                                        <div class="form-group">
                                            <label class="info_ques_text">How Long Do You Work Per Day?</label>
                                            <div class="input-group">
                                                <select class='input' name="Work" id="Work" ng-model="data.work" ng-selected="" required>
                                                    <option value="" disabled selected>Select Your Option</option>
                                                    <option value="0">4-5 Hours</option>
                                                    <option value="1">5-6 Hours</option>
                                                    <option value="2">6-7 Hours</option>
                                                    <option value="3">More than 7 Hours</option>
                                                </select><br>
                                                <span class="error_msg" ng-show="submitted && info_form.Work.$error.required">Value cannot be blank</span>
                                            </div>
                                        </div> 
                                        <input class="input" type="hidden" name="Email" id="Email" class="form-control" ng-model="data.email" value="<?php echo($email); ?>"><br>

                                        <!--                                    <div style="margin-left: 10px;"><button1><a href=""  ng-click="submitted = true;
                                                                                            submit(data)">Submit</a></button1></div>
                                        -->

                                    </div>

                                </div>

                            </div>
                        </div>
                    </div>
                    <div class="box-footer" ng-show="table_remove">
                        <button href="" type="submit" ng-click="submitted = true;
                                    train(data);" class="btn btn-primary">Train data</button>
                        <button href="" type="submit" ng-click="submitted = true;
                                    submit(data);
                                    template = 'addeditview'" class="btn btn-primary">Submit</button>
                        <a type="button" class="btn btn-danger" href="{{url()}}/admin/organizations/view">Cancel</a>
                    </div>
                    <?php
                    echo form_close();
                    ?>
                </div>
            </section><!-- /.content -->


            <ng-include src="template"></ng-include>

            <script type="text/ng-template" id="addeditview">

                <form class="form-horizontal" role="form" id="prediction_form" name="prediction_form" ng-controller="infoCtrl" ng-app="app" ng-submit="submit(data)" novalidate>





                <div class="form-group">
                <label class="info_ques_text">How Long Do You Work Per Day?</label>
                <div class="input-group">
                <select class='input' name="Work" id="Work" ng-model="data.work" ng-selected="" required>
                <option value="" disabled selected>Select Your Option</option>
                <option value="0">4-5 Hours</option>
                <option value="1">5-6 Hours</option>
                <option value="2">6-7 Hours</option>
                <option value="3">More than 7 Hours</option>
                </select><br>
                <span class="error_msg" ng-show="submitted && info_form.Work.$error.required">Value cannot be blank</span>
                </div>
                </div> 




                </form>



            </script>

        </div>
    </div>





</body>
</div>

填写您的医疗信息
年龄

值不能为空 性 选择您的选项 男性 女性
值不能为空 血压
值不能为空 血糖 选择您的选项 低 正常的 高
值不能为空 最大心率
值不能为空 倾斜最高峰运动ST段
值不能为空 主要船只数目 选择您的选项 0 1. 2. 3.
值不能为空 吸烟 选择您的选项 不 是的,重度吸烟者 是的,轻度吸烟者
值不能为空 锻炼 选择您的选项 不 对
值不能为空 饮酒
<ng-include src="template.html"></ng-include>