angularjs - Include specific form from template Angular JS -


i have html template 3 forms in it. need reuse controller , 2 forms template in page. how can achieve this?

mainform.htm

<form ng-show="activetab == 'form1'" name="form1" id="form1"> <p> form1 </p> </form>  <form ng-show="activetab == 'form2'" name="form2" id="form2">     <p> form2 </p> </form>  <form ng-show="activetab == 'form3'" name="form3" id="form3">     <p> form3 </p> </form> 

subform.htm

<div ng-include="mainform.htm"> <p> need form1 , form3 mainform.htm here</p> </div> 

as commented in question, best way creating each form in separate view , ng-include need.

form1.html

<form method="post" name="form1" id="form1">  <!-- form code --> </form> 

(and repeat example each form)

mainform.html

<div ng-show="activetab == form1">   <div ng-include="form1.html"></div> </div> <!-- each other form want --> 

Comments