define(['angular'], function(angular) {
    'use strict';

    var TEXT_CLASS = 'icls:text';

    return function($scope, ItemListLoader) {
        $scope.params = {
            sort: '[("firstCreated", -1)]',
            where: {itemClass: TEXT_CLASS},
            skip: 0,
            limit: 25
        };

        $scope.fetch = function(options) {
        	angular.extend($scope.params, options);
        	$scope.items = ItemListLoader($scope.params);
        };

        $scope.prev = function() {
            var skip = $scope.params.skip - $scope.params.limit;
            if (skip < 0) {
                skip = 0;
            }
            $scope.fetch({skip: skip});
        };

        $scope.next = function() {
            var skip = $scope.params.skip + $scope.params.limit;
            $scope.fetch({skip: skip});
        }

        $scope.search = function(query) {
        	if (query && query.length > 2) {
        		$scope.fetch({
                    q: query,
        			skip: 0
        		});
        	} else if (query.length === 0) {
        		$scope.fetch({
                    q: null,
        			skip: 0
        		});
        	}
        };

        $scope.fetch();
    };
});

@@ -85,16 +85,86 @@
 s:text';
+%0A    var STORAGE_KEY = 'items.list';%0A    var storage = sessionStorage;
 %0A%0A    re
@@ -460,24 +460,97 @@
 , options);%0A
+            storage.setItem(STORAGE_KEY, angular.toJson($scope.params));%0A
         %09$sc
@@ -1291,32 +1291,213 @@
  %09%7D%0A        %7D;%0A%0A
+        if (storage.hasOwnProperty(STORAGE_KEY)) %7B%0A            var options = angular.fromJson(storage.getItem(STORAGE_KEY));%0A            $scope.fetch(options);%0A        %7D else %7B%0A    
         $scope.f
@@ -1504,16 +1504,26 @@
 etch();%0A
+        %7D%0A
     %7D;%0A%7D

Save items list state into storage.