This article mainly introduces the use of tables in AngularJS. As a popular JavaScript framework, AngularJS provides a powerful table function. If you need it, you can refer to the following table data, which is usually repeated in nature. The ng-repeat command can be used to easily draw tables. The following example shows how to use the ng-repeat command to draw a table.
Name |
Marks |
{{ subject.name }} |
{{ subject.marks }} |
You can use the CSS style to set the style of a table as follows:
Example
The following example shows all the preceding commands.
TestAngularJS.html
Angular JS TableAngularJS Sample Application
Enter first name: |
|
Enter last name: |
|
Name: |
{Student. fullName ()}} |
Subject: |
Name |
Marks |
{Subject. name }} |
{Subject. marks }} |
|
Script 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