डाउनलोड पी.डी.एफ. ई-बुक्स
AJS - Directives ng-include

ng-include directive; External file को include करने के लिए इस्तेमाल किया जाता है |


Syntax for ng-include Directive in AngularJS

As Attribute :
<element ng-include="filename">
</element>

As Element :
<ng-include src="filename">
</ng-include>

ng-include Attribute's Parameters in AngularJS

filename : यहाँ पर single quote('') में file name दिया जाता है |


Example for ng-include Directive using String in AngularJS

Sample.html
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
</head>
<body ng-app="">

<div ng-include="'External.html'"></div>

</body>
</html>
External.html
<div ng-init="var = 'Hello World'">
{{var}}
</div>
Output :
Hello World