mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Better flickr sizing
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user