Ich habe ein Formular und es hat mehrere Tasten. Wenn Sie auf eine dieser Schaltflächen klicken, sollte dieses Formular ein anderes Formular entfernen und laden. Ich versuche dies mit der ng-include-Methode zu tun. Ich habe das schon einmal gemacht und es zur Arbeit gebracht. Aber ich kann nicht verstehen, warum das nicht funktioniert.ng-include funktioniert nicht wie es angenommen
Ich habe die zweite Form innerhalb des Skript-Tags angegeben und wenn ich auf die oben erwähnte Schaltfläche klicke, wird dieses Formular aufgerufen. Aber es lädt nicht.
Ich habe das bestehende Formular mit der ng-if-Methode im Controller entfernt.
Mein HTML-Code
<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>
ich mehr 'ng-app' Instanzen zu sehen. Ich bezweifle, dass das richtig funktioniert – Phil
Ich entfernte die ng-app in Code innerhalb der Script-Tags .. immer noch nicht funktioniert – CraZyDroiD
kann mir jemand helfen? – CraZyDroiD