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