AngularJS ng-includeनिर्देश


उदाहरण

बाहरी फ़ाइल से HTML शामिल करें:

<div ng-include="'myFile.htm'"></div>

परिभाषा और उपयोग

निर्देश में ng-includeबाहरी फ़ाइल से HTML शामिल है।

शामिल सामग्री को निर्दिष्ट तत्व के चाइल्डनोड्स के रूप में शामिल किया जाएगा।

विशेषता का मान ng-includeएक फ़ाइल नाम लौटाते हुए एक अभिव्यक्ति भी हो सकता है।

डिफ़ॉल्ट रूप से, शामिल फ़ाइल दस्तावेज़ के समान डोमेन पर स्थित होनी चाहिए।


वाक्य - विन्यास

<element ng-include="filename" onload="expression" autoscroll="expression" ></element>

एनजी-शामिल निर्देश को एक तत्व के रूप में भी इस्तेमाल किया जा सकता है:

<ng-include src="filename" onload="expression" autoscroll="expression" ></ng-include>

सभी HTML तत्वों द्वारा समर्थित।


पैरामीटर मान

Value Description
filename A filename, written with apostrophes, or an expression which returns a filename.
onload Optional. An expression to evaluate when the included file is loaded.
autoscroll Optional. Whether or not the included section should be able to scroll into a specific view.