Skip to content

Instantly share code, notes, and snippets.

@ashanbh
Created February 10, 2015 03:11
Show Gist options
  • Save ashanbh/0ea5c8b6f693547fa5ee to your computer and use it in GitHub Desktop.
Save ashanbh/0ea5c8b6f693547fa5ee to your computer and use it in GitHub Desktop.
Angular binding performance test
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-ngControllerAs-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0-beta.1/angular.min.js"></script>
<script >
(function(angular) {
'use strict';
angular.module('controllerAsExample', [])
.controller('SettingsController1', SettingsController1);
function SettingsController1() {
this.name = "John Smith";
this.numContacts = 5000;
this.obj = [];
for (var i = 0; i < this.numContacts; i++) {
this.obj.push({
id: 'User-' + i,
checked: 'false'
});
}
}
})(window.angular);
</script>
</head>
<body ng-app="controllerAsExample">
<div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
<table>
<tr>
<td>
<div ng:repeat="o in settings.obj">
{{::o.id}}
<input type="checkbox" ng:model="o.checked" />
</div>
</td>
<td>
{{settings.name}}
</td>
<td>
<div ng:repeat="o in settings.obj">
{{::o.id}} <input type="checkbox" ng:model="o.checked" />
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment