Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Angular example using track by #9

Merged
merged 1 commit into from
Jun 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions angular-track-by/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
angular.module('app', []).controller('DBMonCtrl', function ($scope, $timeout) {
$scope.databases = [];
var load = function() {
$scope.databases = ENV.generateData().toArray();
Monitoring.renderRate.ping();
$timeout(load, ENV.timeout);
};
load();
});
46 changes: 46 additions & 0 deletions angular-track-by/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html ng-app="app">
<head>
<meta name="description" content="DBMON Angular" />
<script src="../lib/angular.min.js"></script>
<link href="../lib/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="../styles.css" rel="stylesheet" type="text/css" />
<meta charset="utf-8">
<title>dbmon (angular)</title>
</head>
<body ng-controller="DBMonCtrl">
<!-- DBMon -->
<div>
<table class="table table-striped latest-data">
<tbody>
<!-- Database -->
<tr ng-repeat="db in databases track by $index">
<td class="dbname">
{{db.dbname}}
</td>
<!-- Sample -->
<td class="query-count">
<span class="{{db.lastSample.countClassName}}">
{{db.lastSample.queries.length}}
</span>
</td>
<!-- Query -->
<td ng-repeat="q in db.lastSample.topFiveQueries track by $index" class="{{q.elapsedClassName}}">
{{q.formatElapsed}}
<div class="popover left">
<div class="popover-content">
{{q.query}}
</div>
<div class="arrow"></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<script src="../ENV.js"></script>
<script src="../lib/memory-stats.js"></script>
<script src="../lib/monitor.js"></script>
<script src="app.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<br/>
<ul>
<li><a href="./angular-oneway">DBMON Angular with one-way databinding</a></li>
<li><a href="./angular-track-by">DBMON Angular with track by $index</a></li>
<li><a href="./vanilla-optimized">DBMON vanilla</a></li>
</ul>
</div>
Expand Down