Angularjs includes detailed and sample code _ANGULARJS

Source: Internet
Author: User
Tags php web server

HTML does not support HTML pages that are embedded in HTML pages. This functionality is achieved by using the following methods:

1. Use Ajax -let a server call to get the corresponding HTML page and set it to the innerHTML of the HTML control.

2. The use of server-side include -jsp,php Web server technology can be included in the dynamic page of the HTML page.

Using ANGULARJS, we can embed another HTML page in an HTML page using the ng-include instruction.

<div ng-app= "" ng-controller= "Studentcontroller" >
  <div ng-include= "' main.html '" ></div>
  <div ng-include= "' subjects.html '" ></div>
</div>

Example

Tryangularjs.html

 

Main.html

<table border= "0" >
  <tr><td>enter name:</td><td><input type= "text" Ng-model= "Student.firstname" ></td></tr>
  <tr><td>enter Last Name: </TD><TD ><input type= "text" ng-model= "Student.lastname" ></td></tr>
  <tr><td>name: </td><td>{{student.fullname ()}}</td></tr>
</table>

Subjects.html

<p>Subjects:</p>
<table>
  <tr>
   <th>Name</th>
   <th> marks</th>
  </tr>
  <tr ng-repeat= "subject in Student.subjects" >
   <td>{{ Subject.name}}</td>
   <td>{{subject.marks}}</td>
  </tr>
</table>

Output

To run this example, you need to deploy textangularjs.html,main.html and subjects.html to a network server. Open textangularjs.html in a Web browser using the server URL. See the results.

The above is ANGULARJS including the data collation, follow-up to continue to collate relevant knowledge, thank you for your support of this site!

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.