Skip to content

Instantly share code, notes, and snippets.

@scttymn
Created May 28, 2013 03:36
Show Gist options
  • Save scttymn/5660376 to your computer and use it in GitHub Desktop.
Save scttymn/5660376 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<title>Sinatra JSON API Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js"></script>
<script src="/controllers.js"></script>
</head>
<body ng-controller='ThingController'>
<h2>New Thing</h2>
<form id="new-thing">
<p><strong>Title:</strong></p>
<input ng-model="thing.title" type="text">
<p><strong>Description:</strong></p>
<textarea ng-model="thing.description"></textarea>
<p><input ng-click="create(thing)" type="submit"></p>
</form>
<h2>All The Things!</h2>
<table>
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr ng-repeat='thing in things'>
<td>{{thing.title}}</td>
<td>{{thing.description}}</td>
<td><a href="#" ng-click="delete(thing)">delete</a></td>
</tr>
</tbody>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment