I would like to create a scrollView with elements that have different heights.
I think I am supposed to translate each views and apply an offset to each one of them but how I am supposed to do this if height is dynamic for each view (what's inside it) ?
I am trying to build a chat.
Thank you
Code taken from the famous/angular docs for scrollView
<fa-app ng-controller="ScrollCtrl">
<fa-scroll-view fa-pipe-from="myEventHandler">
<fa-view ng-repeat="view in views"> // views have different heights//
<fa-modifier fa-size="[undefined, undefined]">
<fa-surface fa-pipe-to="myEventHandler">
My surface with things inside it. what if its big?
</fa-surface>
</fa-modifier>
</fa-view>
<script>
angular.module('faScrollViewExampleApp', ['famous.angular'])
.controller('ScrollCtrl', ['$scope', '$famous', function($scope, $famous) {
var EventHandler = $famous['famous/core/EventHandler'];
//$scope.views = some item with differents heights
$scope.myEventHandler = new EventHandler();
}]);
</script>
To adapt the height of a view based on its content, you shoud use
[undefined, true]
, but it still has some issue, so be sure to check github for any fix.In your case, to achieve your goal, I would suggest to use a
Transitionable
value that you can use to dynamically change the value of your view from you controller when you know the correct size.Something like this:
Your view:
Your controller: