ANGULARJS Basic Ng-include Instruction example explain _ANGULARJS

Source: Internet
Author: User


Angularjs ng-include Instruction



Angularjs instance



Include HTML file:


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">

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

</body>
</html>


Run Result:



MyFile.htm file Title



This text comes from the contained file myfile.htm!



Definitions and usage



The ng-include directive is used to include an external HTML file.



The contained content will be the child node of the specified element.



The value of the ng-include property can be an expression that returns a filename.



By default, included files need to be included under the same domain name.



Grammar



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



Ng-include directives are used as elements:



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



All HTML elements support this directive.



Parameter values





value Description
FileName File name, you can use an expression to return the file name.
OnLoad Optionally, an expression that executes after the file is loaded.
AutoScroll Optionally, the included portion is scrollable on the specified view.





The above is the Angularjs ng-include instruction of knowledge collation, follow-up continue to add.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.