This article mainly introduces how to use AngularJS to implement HTML page nesting, mainly using the ng-include command in AngularJS, for more information, see HTML. HTML pages embedded in HTML pages are not supported. You can use the following methods to implement this function:
- Use Ajax-Let a server call to obtain the corresponding HTML page and set it in the innerHTML of the HTML control.
- You can use Web server technologies such as-JSP and PHP on the server to include HTML pages on dynamic pages.
With AngularJS, we can use the ng-include command to embed an HTML page into another HTML page.
Example
TryAngularJS.html
Angular JS uplodesAngularJS Sample ApplicationScript function studentController ($ scope) {$ scope. student = {firstName: "Mahesh", lastName: "Parashar", fees: 500, subjects: [{name: 'physics ', marks: 70}, {name: 'chemistry ', marks: 80}, {name: 'Math', marks: 65}, {name: 'inc', marks: 75}, {name: 'hindi ', marks: 67}], fullName: function () {var studentObject; studentObject = $ scope. student; return studentObject. firstName + "" + studentObject. lastName ;};} script