Skip to content

Instantly share code, notes, and snippets.

@jpotts18
Created April 5, 2013 18:31
Show Gist options
  • Save jpotts18/5321537 to your computer and use it in GitHub Desktop.
Save jpotts18/5321537 to your computer and use it in GitHub Desktop.
Angular Demo
function PhoneListCtrl($scope) {
$scope.phones = [
{"name": "Nexus S",
"snippet": "Fast just got faster with Nexus S."},
{"name": "Motorola XOOM™ with Wi-Fi",
"snippet": "The Next, Next Generation tablet."},
{"name": "MOTOROLA XOOM™",
"snippet": "The Next, Next Generation tablet."}
];
}
function TeamListCtrl($scope, $http){
$http.get('api/teams').success(function(data){
$scope.teams = data;
});
}
<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<title>Login</title>
<link rel="stylesheet" type="text/css" href="/styles/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/styles/flat-ui.css">
<script src="scripts/angular.js"></script>
<script src="scripts/app/controllers.js"></script>
</head>
<body>
<div class="padding" style="margin-top:50px"></div>
<div class="container">
<div class="offset3 span6 well">
<h1>Welcome to Smacktalk Admin</h1>
<p>Nothing here {{'yet' + '!'}}</p>
<input type="text" placeholder="Username" class="span3">
<input type="text" placeholder="Password" class="span3">
<a href="#" class="btn btn-large">Log In</a>
</div>
</div>
<div ng-controller="PhoneListCtrl">
<ul>
<li ng-repeat="phone in phones">
{{phone.name}}
<p>{{phone.snippet}}</p>
</li>
</ul>
<p>Total Phones : {{phones.length}}</p>
</div>
<div ng-controller="TeamListCtrl">
<div ng-repeat="team in teams | filter: query| orderBy:name">
<p> {{team.name}} from {{team.location}}<p>
<img ng-src="{{team.imgUrl}}">
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment