Issues with iScroll5 and Angularjs 1.2 compatibility

Attached

<script src="js/angular/angular.js"></script>    
<script src="js/lib/iscroll.js"></script>
<script src="js/lib/ng-iscroll.js"></script>

JS File

var App = angular.module('MyApp', [ 'ng-iscroll', ]);

App.controller('LoadUsers', ['$scope', function ($scope) {
    $.ajax({
        url: JSON URL HERE,
        type: 'GET',
        dataType: 'json',
        headers: {
            'Accept-Encoding': 'gzip'
        },
        crossDomain: true,
        timeout: 15000,
        success: function (data) {
            var nData = [];
            angular.forEach(data, function (value, key) {
                /* ############################ Scope ############################ */
                var nItem = {};
                nItem.fleetUser = value.name;
                nData.push(nItem);
            });

            $scope.fleet = nData;
            $scope.$apply();

        },
        error: function (data) {
            $scope.error = true;
            $scope.$apply();
        }
    });

}]);

HTML

<div ng-controller="LoadUsers">
    <div id="wrapper" ng-iscroll>
        <ons-list>
            <ons-list-item ng-show="error">Server Connection Error</ons-list-item>
            <ons-list-item class="topcoat-list__item__line-height" ng-repeat="item in fleet">{{item.fleetUser}}
                <br/>
            </ons-list-item>
        </ons-list>
    </div>
</div>

I am experiencing difficulties while trying to integrate the latest iScroll version into my project. The list on my mobile device is not displaying and I keep encountering this error message:

Uncaught TypeError: Cannot read property 'length' of undefined iscroll.js:1303
IScroll.goToPage iscroll.js:1303
IScroll._wheel iscroll.js:1084
IScroll.handleEvent

Is this the correct approach for implementing iScroll within an Angular repeat? The list functions properly without it.

Thank you

Answer №1

UPDATE

If you're facing issues with ng-repeat and iscroll4, you may want to check out a solution provided by @acido69 on GitHub. It worked for me personally.

<li ng-repeat="list in lists">
    <h3>{{list.text}}</h3>
    <p>{{list.done}} With Angular JS</p>
    {{ updateScroll($last) }}

// in controller
var Scroller = new iScroll('wrapper');
$scope.lists = [{text:'', done:''}];
$scope.updateScroll = function(isLast){
  if(isLast) Scroller.refresh()
}

Check out this Example

ORIGINAL ANSWER

Currently, it seems like there is an unresolved issue with ng-repeat and iscroll4. You can read more about it in the ng-iscroll issue on GitHub.

Hopefully, they will address this issue soon.

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

Combining the SanitizeFunction with React's textArea feature for onPaste integration

Scenario: I encounter a scenario where the user has the ability to paste ONE of the strings listed below into the textArea, and it should be formatted onto new lines: Comma-space (Example: 12, 2, 3) Comma-newline (Example: 12,\n2,\n3,\n) ...

Remove any objects from the array that have empty values when filtered

I am facing a challenge with filtering objects in an array. Each object contains a title and rows, where the rows also have a risk value (like P1, P2, P3, etc.). My goal is to extract only the rows that have a risk equal to P1 while skipping any objects th ...

Firebase scheduled function continues to encounter a persistent issue with an "UNAUTHENTICATED" error being consistently thrown

I have created a firebase-function that is scheduled to retrieve data from an external API source and save it in Firestore. const functions = require("firebase-functions"); const admin = require("firebase-admin"); const { default: Axios ...

What is the procedure for initiating a POST request when the payload is ready for submission?

After a successful payment, my success page is displayed with a URL that includes a query parameter. I want to make a POST request to my API endpoint when the page loads, but I'm encountering an issue where the first POST request is empty (router.quer ...

The conditional rendering logic in the ng-if directive does not seem to be synchronizing

Currently, I am delving into AngularJS and working on a basic application to gain familiarity with it. Within my app, there are four tabs: List, Create, Update, and Delete. However, my goal is to only display the Update and Delete tabs when I press the b ...

Setting values for an array in Javascript

Is there a way to divide a given value by 10 and store the resulting values in an array? How can I then assign these values back to 'array1' within a for loop? var value = 300000; var array1= new Array(11); var yaxispoints = value / 10; for(v ...

Guide on how to retrieve the vertex information once an object is loaded using the ObjLoader in Three.js

When using ObjLoader in Three.js to load a *.obj file into my scene, everything works fine. However, I'm uncertain on how to manipulate the object's vertices and indices individually. How can I access the vertices of the loaded *.obj model? Atte ...

The plus sign ('+') fails to be matched by the regular expression in Angular 2, although it functions correctly in other testing environments

Check out this code snippet: export const PASSWORD_PATTERN: RegExp = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9`~!@#$%^&*()\-_+={[}\]|\\:;"'<,>.?/]{8,}$/; This constant is utilized in the following manner elsewhere: ...

Using intricate document text as the input parameter in Vue: A guide

I am currently working with this Vue code snippet: <script> var starting_point = '{{ form.content.data }}'; vm = new Vue({ el: '#editor', data: { input: starting_point }, computed: { compiledMarkdown: function () ...

Discover the steps for dynamically integrating ionRangeSliders into your project

Recently, I integrated ionRangeSlider to display values to users using sliders. To set up a slider, we need to define an input tag like this: <input type="text" id="range_26" /> Then, we have to use jQuery to reference the input tag's ID in or ...

Creating raw JavaScript from npm package:How to convert npm modules into plain

Is there a way to get a pre-compiled plain JavaScript file from the repository https://github.com/airbrake/airbrake-js? I'm looking for a solution without using bower, npm or any other tools - just a single JavaScript file. By the way: The file "http ...

Dim the background for all elements except for one

Seeking a way to create a dimmed-background effect by adjusting the opacity of all elements on the page except for one specific element. I've experimented with using the :not() selector as well as jQuery selectors to exclude certain elements, but have ...

Incorporating external CSS links in the metadata of Next.js 13

A recent update in Nextjs 13 introduced a new feature known as Metadata (https://nextjs.org/docs/app/api-reference/functions/generate-metadata), causing the removal of Head.js. Previously, I would import a CSS file using the <Head> tag as shown below ...

I'm struggling to resolve the issue I'm encountering with findOneAndUpdate. Can anyone offer guidance on how to

Attempting to modify a mongodb document using the findOneAndUpdate method. Experimented with various approaches to locating the document and restructuring the update operation. router.put( "/edit", [ auth, [ check("name", "Name is requi ...

Select the directory for downloading the file in your REACTJS application

I am working on a code snippet that generates a URL containing a .csv file for downloading. const getCSVURL = async () => { const response = await PerformanceFilterManager.getCSVURL(); setCSVUrl(response); }; This function is triggered by click ...

Need assistance using a form within a popover in Angular UI Bootstrap?

I have implemented a button that triggers an Angular UI Bootstrap popover by using a template. If you want to see it in action, you can check out this demo The popover template consists of a form containing a table with various text fields that are bound ...

Encountering a 404 Not Found error while attempting to reach a Node/Express endpoint from the client side

I've developed a Node.js/Express REST API to be utilized by a frontend React application for an inventory management system intended for a garage sale. When attempting to add a new product, I'm trying to access the POST route http://localhost:300 ...

Tips on preventing the occurrence of double encoding in raw JSON output from a view

I am encountering a JavaScript error while attempting to parse JSON data obtained from my controller: Uncaught SyntaxError: Unexpected token & in JSON at position 1 at JSON.parse () at stores:76 This is the code I use to serialize my list of elem ...

Ensuring the Presence of Component Props in Styled Components

I have a dilemma with a component that accepts a prop to render another component. Here is the setup: const IconBase = styled.div` // CSS Styles Here `; const Icon = props => ( <IconBase> <props.name /> </IconBase> ); This ...

React application experiencing asynchronous function that is not returning

In my React app, I have an asynchronous function in a file (someFile.js) and I need the returned string from that function (someFunction) to be displayed on the webpage once it's done. However, I'm facing an issue where the webpage appears blank ...