ng-include

What is ng-include:ng-include used to show, compile , include HTML part..
Description of ng-include:ng-include has priority 0.
It is always created new scope, means code included by ng-include always add as a newly DOM.
It is used in three form : element, attribute, class..
Syntax of ng-include:
<element ng-include="expression">

</element>
or
<ng-include src="expression">

</ng-include>
or
<element class="ng-include">


</element>
How to Use ng-include/ng-include Example::
Example 1:
<div ng-app="webapp">
    <div >
        <div>
            Angularjs Example of ng-include
            <label><input type="radio" name="rdo" value="htmltemplate1" /> include htmltemplate1</label>
            <label><input type="radio" name="rdo" ng-value="htmltemplate2" />include htmltemplate1</label>
            <div ng-include="expression">

            </div>
        </div>
    </div>
</div>
  htmltemplate1.html
<div> Hello this is htmltemplate1</div>
 htmltemplate2.html

<div> Hello this is htmltemplate2</div>

No comments :

Post a Comment