Skip to content

Instantly share code, notes, and snippets.

@ciwolsey
Created November 7, 2014 11:34
Show Gist options
  • Select an option

  • Save ciwolsey/aba65b493c13d2a2ec19 to your computer and use it in GitHub Desktop.

Select an option

Save ciwolsey/aba65b493c13d2a2ec19 to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Angular Test</title>
<script type="text/javascript" src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bower_components/angular-resource/angular-resource.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body ng-app="colorApp">
<div ng-controller="colorsListController as colorList">
<div ng-repeat="color in colorList.colors" style="background-color: {{color.hex}}">
<h1>{{color.hex}}</h1>
</div>
<button ng-click="changeColors()">Hello</button>
</div>
</body>
</html>
var app = angular.module('colorApp', []);
app.controller('colorsListController', ['$http', function ($http) {
var colorsList = this;
this.colors = [{hex: '#0000FF'}];
$http.get('http://fscker.co.uk:8080/api/bah.json').success(function(data){
colorsList.colors = data;
});
this.changeColors = function(){
console.log("meh");
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment