Skip to content

Instantly share code, notes, and snippets.

@blittle
Created November 28, 2013 18:11
Show Gist options
  • Save blittle/7696111 to your computer and use it in GitHub Desktop.
Save blittle/7696111 to your computer and use it in GitHub Desktop.
LehiWest Angular Sample
<!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta http-equiv="X-UA-Compatible" content="chrome=1"/>
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.3.0/pure-min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"></script>
</head>
<body ng-app="myApp">
<div ng-controller="MyController">
<table>
<tr ng-repeat="user in users | filter: myFilter"><td><input type="checkbox"/></td><td>{{user.name}}</td></tr>
</table>
<div>User Name<input type="text" ng-model="newUser"/></div>
<div>Filter<input type="text" ng-model="myFilter"/></div>
<button ng-click="addUser(newUser)">Add User</button>
</div>
</body>
<script>
var myApp = angular.module('myApp', []);
myApp.controller('MyController', function($scope, $http) {
$scope.users = [
{
"name": "Bret"
},
{
"name": "Jason"
},
{
"name": "Daren"
}
];
$scope.addUser = function(newUser) {
$scope.users.push({
"name": newUser
});
$scope.newUser = "";
}
});
myApp.directive('myList', function() {
return {
restrict: 'A',
transclude: true,
template: "<div ng-transclude></div>",
link: function(scope, el, attr) {
}
}
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment