Skip to content

Instantly share code, notes, and snippets.

@CarlLee
Created August 13, 2015 16:07
Show Gist options
  • Save CarlLee/453412e15e5f97f8f417 to your computer and use it in GitHub Desktop.
Save CarlLee/453412e15e5f97f8f417 to your computer and use it in GitHub Desktop.
Angular.js example
angular.module('app', [])
.controller('ItemsCtrl', function($scope, $http){
$scope = $http.get('items.json').success(function(data){
$scope.items = data;
});
});
<html>
<head>
<script src='angular.js'/>
<script src='app.js'/>
</head>
<body ng-app='app'>
<div ng-controller='ItemsCtrl'>
<ul ng-repeat='item in items'>
<li>{{ item.name }}: {{ item.price }}</li>
</ul>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment