Created
November 7, 2014 11:34
-
-
Save ciwolsey/aba65b493c13d2a2ec19 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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