Better flickr sizing

This commit is contained in:
Max Lynch
2013-12-09 17:35:45 -06:00
parent 000546835c
commit 4f63456c59
2 changed files with 12 additions and 1 deletions

View File

@@ -39,7 +39,7 @@
</div>
<content id="content" push-search>
<div id="photos" class="clearfix">
<div class="photo" ng-repeat="photo in photos.items" ng-style="photoStyle">
<div class="photo" ng-repeat="photo in photos.items">
<img ng-src="{{ photo.media.m }}">
</div>
</div>

View File

@@ -20,7 +20,9 @@ angular.module('myApp', ['ionic', 'ngResource'])
}
}
})
.controller('FlickrCtrl', function($scope, Flickr) {
var doSearch = ionic.debounce(function(query) {
Flickr.search(query).then(function(resp) {
$scope.photos = resp;
@@ -54,3 +56,12 @@ angular.module('myApp', ['ionic', 'ngResource'])
}
})
.directive('photo', function($window) {
return {
restrict: 'C',
link: function($scope, $element, $attr) {
var size = ($window.outerWidth / 3) - 2;
$element.css('width', size + 'px');
}
}
});