fields should be mandatory in Angular ng-template

n_16
Tera Contributor

Hello community leadres,

 

We have created one "Angular ng-template" under the widget to show some pop-up while approver approving the request from serviceportal.This pop-up is to enetring some values before approving the request. Below is the code that i have been used in "Angular ng-template".

 

 

<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Please enter Cost & Cost Center details below<button class="glyphicon glyphicon-remove pull-right" ng-click="c.data.closeModal()" style="color:white;background-color: #4CAF50"> <span ></span>
</button></h4>
</div>
<div class="panel-body wrapper-xl">
<form name="modalTemplateS/4" ng-submit="c.data.costs4(c.data.costs41)">
<div class="test">
<label><b>Cost</b></label><input type="test" ng-model="c.data.costs4" name="costs4" ng-required></div>
</form>
<br>

<form name="modalTemplateS/4" ng-submit="c.data.costs3(c.data.costs31)">
<div class="test">
<label><b>Cost Center</b></label><input type="test" ng-model="c.data.costs3" name="costs3" ng-required></div>
</form>
<br>

<button type="button" name="submit" class="btn btn-default btn-question" ng-click="c.data.close(c.data.costs41)" style="color:white;background-color: #4CAF50">Submit</button>
<font color="red"><span ng-if="c.data.costs4 == false">***Please enter Cost***</span></font>

</div>
</div>

n_16_0-1674026982254.png

 

 

Now, this pop should not allow to submit without entering those cost & costcentere details. I have tried by using ng-required however it is not working.Please help here.

 

 

 

Thanks in advance

2 REPLIES 2

Ankita19
Tera Guru
Tera Guru

Hi ,

 Try ng-required="true".

 

Ankita19
Tera Guru
Tera Guru

Hi,

 

Or try to add only required> word at last .