playing with angularjs
This commit is contained in:
parent
14326b0fce
commit
cca99e23b7
2 changed files with 27 additions and 0 deletions
13
src/main/webapp/album.js
Normal file
13
src/main/webapp/album.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
var album = angular.module("album", [ ]);
|
||||||
|
|
||||||
|
album.controller("AlbumController", ["$http", "$log", function($http, $log) {
|
||||||
|
var alb = this;
|
||||||
|
this.items = [ ];
|
||||||
|
this.update = function() {
|
||||||
|
$log.info("updating...");
|
||||||
|
$http.get("/photo/album/Downloads.json").success(function(data) {
|
||||||
|
alb.items = data.contents;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}]);
|
||||||
14
src/main/webapp/ang.html
Normal file
14
src/main/webapp/ang.html
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html ng-app="album">
|
||||||
|
<head>
|
||||||
|
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.20/angular.js"></script>
|
||||||
|
<script src="album.js"></script>
|
||||||
|
</head>
|
||||||
|
<body ng-controller="AlbumController as album">
|
||||||
|
<h1>Album</h1>
|
||||||
|
<form><input type="button" ng-click="album.update()" value="Update" /></form>
|
||||||
|
<div ng-repeat="item in album.items">
|
||||||
|
<img ng-src="/photo/album{{ item.path }}?size=250"/>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Add table
Reference in a new issue