Skip to content

Instantly share code, notes, and snippets.

@DanWahlin
Created October 25, 2015 18:14
Show Gist options
  • Save DanWahlin/e3306ce06cd08811f4bc to your computer and use it in GitHub Desktop.
Save DanWahlin/e3306ce06cd08811f4bc to your computer and use it in GitHub Desktop.
Simple Angular App with Controller
<html ng-app="app">
<body>
<div ng-controller="CustomersController">
Name: <input type="text" ng-model="searchText" /> {{ searchText }}
<br />
<ul>
<li ng-repeat="person in people | filter:searchText | orderBy:'name' track by person.id">
{{ ::person.name }} - {{ ::person.city }}
</li>
</ul>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
<script>
angular
.module('app', [])
.controller('CustomersController', CustomersController);
function CustomersController($scope) {
$scope.people=[
{id: 1, name: 'Ward', city: 'San Francisco'},
{id: 2, name: 'Shirley', city: 'Phoenix'},
{id: 3, name: 'John', city: 'Orlando'},
{id: 4, name: 'Buttercup', city: 'La La Land'}
];
$scope.searchText = '';
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment