ui-scroll - unable to return to the start of the list

How can I achieve a scroll downwards and then return to the beginning of the list?
I've searched for examples on how to implement ui-scroll back and forth, but none seem to fit my needs.

Please assist.
You can find the fiddle here: http://jsfiddle.net/4hrjeyqd/3/

 <div ui-scroll-viewport class="testStyle">
   <div ui-scroll="item in datasource" buffer-size='5' adapter="datasource.adapter">
     *one {{item}}*
   </div>
 </div>

JS:

angular.module('application', ['ui.scroll', 'ui.scroll.jqlite'])
  .factory('datasource', function() {

    var res = {
      data: [],
      adapter: {},
      get: function(index, count, success) {
        console.log('index=' + index + ', count=' + count);

        index--;

        if (index < 0) {
          count += index;
          index = 0;

          if (count < 0) count = 0;
        } else if (index + count >= this.data.length) {
          count = this.data.length - index;
        }

        var dt = this.data.slice(index, index + count);
        success(dt);
      }
    };

    for (var i = 0; i < 100; i++) {
      res.data.push('item ' + i);
    }

    return res;
  });

Answer №1

According to dhilt in the discussion on this issue, the bug was present in version 1.5.0.
Fortunately, versions 1.4.x and 1.5.1 are functioning properly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Node.js and Express throwing errors when trying to access a certain endpoint with HTTPS and passing parameters

I am experiencing issues with my node.js express webserver that operates on both HTTP and HTTPS, specifically related to express's route parameters and HTTPS. Express allows for parameters in the routing, such as: app.get('/users/:userid', ...

Tips on how to sort a dropdown menu in Angular JS?

I've looked at a few similar questions, but their solutions don't seem to be working for me. Here's the code I'm using to display data in an AngularJS table. I want to filter the query to only show SecurityID numbers 8, 9, and 10. When ...

Enhance JSON data with AngularJS through interactive form editing

Attempting to create an editable TreeView in AngularJS using JSON data is proving to be a challenge. The goal is to extract a node value from the JSON and allow editing through forms, with the original JSON updating immediately during the editing process. ...

Angularjs - How come I am able to modify an object but not the list (ng-repeat) from a separate view?

After updating the customers object in the console, I noticed that the list (ng-repeat) is not reflecting the changes. What should I do? Interestingly, it works fine when I implement this function and view2.htm's HTML inside page.htm. HTML "page.htm" ...

Is there a way to streamline this JavaScript Defer code?

I am currently managing a JavaScript bootstrapper module that I want to keep as clean and straightforward as possible. Here is the current code snippet: function bootStrapper() { xmlRepository.getAll().done(function (result) { autoPolicyForm ...

PageCallbacks in .NET 1.1

Is it possible to utilize PageMethods in .NET 1.1 for making server-side method calls from the client side? Could you provide a brief explanation on how to use this feature by calling PageMethods.MyMethod(); ? ...

No matter what I do, I can't seem to stop refreshing the page. I've attempted to prevent default, stop propagation, and even tried using

Below is the code I have written for a login page: import { useState } from "react"; import IsEmail from "isemail"; import { useRouter } from "next/router"; import m from "../library/magic-client"; import { useEffect ...

Navigating within a nested view using Angular's UI-Router

I've encountered a puzzling issue that I've been grappling with for the past three days. It seems like a straightforward problem, but for some reason, it's causing me a lot of trouble. The main parent view in my code contains two child view ...

Tips for changing a specific item within an ng-repeat loop in AngularJS

Here is my HTML code: <tr ng-repeat="customer in customers"> <td> {{customer.customer_name}} </td> <td> {{customer.mobile}} </td> </tr> Upon executing this code, I receive 3 <tr>...</tr> blocks as s ...

Securing paths in NuxtJS

Hey there! I'm just getting started with nuxt and have set up the following routes: /home /dashboard /login My goal is to secure the /dashboard route only for users who are logged in and have a token stored in LocalStorage. The simplest solution ...

What is the best way to pass my request data to my $scope variable?

I'm currently facing a challenge with this particular topic. My goal is to add the response data that I retrieve from Express to my angular $scope and then direct the user to their profile page. This is how my Controller Function is structured: $sc ...

The error message indicates that the argument cannot be assigned to the parameter type 'AxiosRequestConfig'

I am working on a React app using Typescript, where I fetch a list of items from MongoDB. I want to implement the functionality to delete items from this list. The list is displayed in the app and each item has a corresponding delete button. However, when ...

"Utilizing Angular for Select Elements and ng-Option Bindings

I am facing an issue with getting ng-option to work properly. I have a variable alarm.type and I need to create a dropdown list of options derived from $scope.weekTypes. Here is what I have attempted so far: $scope.weekTypes = ["null", "sunday", ...

express path variables are constantly loading

Despite seeing the dynamic id in the URL, I am facing an issue with the page continually loading. Below, you will find the route that HTML redirects us to and details about the database. // Route Parameter app.get('/detail/:id', (req, res) => ...

The function attached to the `click` event of `#cart-continue` is not invoking

I'm currently working on implementing a navigation to a specific anchor tag when the user clicks the continue button on the cart page. This project involves a mobile application built with Cordova, and the function call is done using jQuery. Here is ...

Making adjustments to a Jquery data attribute can have a direct impact on CSS

My CSS is using a data attribute, but when I try to change it with jQuery, the change is not reflected on the screen or in the DOM. $('#new-1').data('count', 5); .fa-stack[data-count]:after { position: absolute; right: -20%; to ...

Error: Unable to call the 'model' function on the 'users' object in Mongoose due

I'm attempting to implement Mongoose's method for defining models in a separate document from their schemas, especially when dealing with multiple databases. Here's the example provided by Mongoose's Docs for User.js: const userSche ...

Displaying two randomly selected entries using AngularJS

After diving into AngularJS, I encountered a challenge that has me stumped. Let's say I have 4 records (car, plane, ship, train) and I only want to display 2 randomly using ng-repeat. Examples: 1st: plane, ship 2nd: car, train 3rd: train, plane So, ...

Unexpected interactions between Socket.io and React using hooks

Currently, I am delving into the world of Socket.io with React utilizing Hooks. My goal is to create a timer that starts upon pressing the start button, and then every second, send the current time in the state to the server using socket.io. The server co ...

Update the JSON data following deletion

I have received the following JSON data: "memberValidations": [ { "field": "PRIMARY_EMAIL", "errorCode": "com.endeavour.data.validation.PRIMARY_EMAIL", "createdDateTime": null }, ...