-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTable
More file actions
115 lines (101 loc) · 3.05 KB
/
Table
File metadata and controls
115 lines (101 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<style>
table, th , td {
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
}
table tr:nth-child(odd) {
background-color: #82E0AA ;
}
table tr:nth-child(even) {
background-color: #2ECC71 ;
}
h1{
color:green;
}
</style>
AnhularJS ng-repeat directives Example with the above codes: Here you will see the combination of above html and css with the AngularJS ng-repeat directives.
filter_none
edit
play_arrow
brightness_4
<!DOCTYPE html>
<html>
<head>
<title>Angular JS Table</title>
<script src =
"https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js">
</script>
<style>
table, th , td {
border: 1px solid black;
border-collapse: collapse;
padding: 5px;
}
table {
background-color: grey;
}
h1{
color:green;
}
</style>
</head>
<body>
<center>
<h1>GeeksforGeeks</h1>
<div ng-app = "mainApp" ng-controller = "studentController">
<table border = "0">
<tr>
<td>Enter first 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>
<tr>
<td>Subject:</td>
<td>
<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>
</td>
</tr>
</table>
</div>
<script>
var mainApp = angular.module("mainApp", []);
mainApp.controller('studentController', function($scope) {
$scope.student = {
firstName: "Pranab",
lastName: "Mukherjee",
subjects:[
{name:'Algorithm',marks:70},
{name:'Data Structure',marks:80},
{name:'Architecture',marks:65},
{name:'Digital Analog',marks:75}
],
fullName: function() {
var studentObject;
studentObject = $scope.student;
return studentObject.firstName + " " + studentObject.lastName;
}
};
});
</script>
</center>
</body>
</html>