The vertical scrolling feature seems to be disabled for ng-repeat within the Angular view

I have a list of customers coming from the backend that I need to populate into ng-repeat. However, even though there are more customers, the vertical scroll is not visible. Why is that?

<link rel="stylesheet" href="hike.css">
<div ng-show='isLoading' class="row">
  <div class="col-mg-12 hike-container">
      <div class="panel-body">
        <div class="table-responsive">
          <table class="hike table table-hover tab-panel tab-content">
            <thead>
              <tr>
                <th>
                    <span>Customer Id</span>
                </th>
                <th>
                    <span>Email</span>
                </th>             
            </tr>
            </thead>
            <tbody>
              <tr ng-repeat="customer in customers" ng-class-odd="'odd'" ng-class-even="'even'">
                  <td>{{customer.id}}</td>

                  <td>{{customer.email}}</td>
                  </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
  </div>
</div>

hike.css

div.lhike-container .lhike{
    background-color: white;
    padding: 0px 0px;
    border-style: solid;
    border-width: 1px 1px 1px 1px;
    border-color: #dde6e9;
}
th {
    background: rgba(102, 123, 147, 0.14);
    text-align: center;
}
tbody > tr.odd{
    background: #FAFBFC;
}
tbody > tr > td {
  text-align: center;
  height: 52px;
  vertical-align: middle;
}

Controller

(function(){
    'use strict';
    angular
    .module('app')
    .controller('CustController', CustController);
    CustController.$inject = ['$scope', 'customerService'];
    function CustController($scope, customerService,){


      $scope.isLoading = false;

      customerService.getCustomers.then(function(response){
        if(response.data.error === 0){
          if(response.data.result.customers){
            $scope.customers = response.data.result.customers;
          }
        }
        $scope.isLoading = true;
      });
    }
})();

Answer №1

Take a look at this code snippet. I needed to simulate your CustomerService, but the scrolling feature is functioning correctly for me. I am using Chrome for testing. One thing I noticed in your HTML is that you are using col-mg-12 from Bootstrap, but it should be col-md-12.

(function() {
  'use strict';
  angular
    .module('app', [])
    .controller('CustController', CustController);
  CustController.$inject = ['$scope'];

  function CustController($scope) {
    $scope.isLoading = false;
    $scope.customers = [{
      id: '1',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="19285928377a7674">[email protected]</a>'
    }, {
      id: '2',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b486f4859ad7dbd9">[email protected]</a>'
    }, {
      id: '3',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2d1e6d1c034e4240">[email protected]</a>'
    }, {
      id: '4',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="370377061954585a">[email protected]</a>'
    }, {
      id: '5',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7c493c4d521f1311">[email protected]</a>'
    }, {
      id: '2',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="605220514e030f0d">[email protected]</a>'
    }, {
      id: '3',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6b582b5a45080406">[email protected]</a>'
    }, {
      id: '4',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b783f78699d4d8da">[email protected]</a>'
    }, {
      id: '5',
      email: '<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="695c2958470a0604">[email protected]</a>'
    }]
  }
})();
div.lhike-container .lhike {
  background-color: white;
  padding: 0px 0px;
  border-style: solid;
  border-width: 1px 1px 1px 1px;
  border-color: #dde6e9;
}
th {
  background: rgba(102, 123, 147, 0.14);
  text-align: center;
}
tbody > tr.odd {
  background: #FAFBFC;
}
tbody > tr > td {
  text-align: center;
  height: 52px;
  vertical-align: middle;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>

<body ng-app="app">
  <div class="row" ng-controller="CustController">
        {{isLoading}}
    <div class="col-mg-12 hike-container">
      <div class="panel-body">
        <div class="table-responsive">
          <table class="hike table table-hover tab-panel tab-content">
            <thead>
              <tr>
                <th>
                  <span>Customer Id</span>
                </th>
                <th>
                  <span>Email</span>
                </th>
              </tr>
            </thead>
            <tbody>
              <tr ng-repeat="customer in customers" ng-class-odd="'odd'" ng-class-even="'even'">
                <td>{{customer.id}}</td>

                <td>{{customer.email}}</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</body>

Answer №2

In cases where scrolling through the table is necessary, you can set a fixed or maximum height for the parent div.

<style>
    .table-scrollable {    
        max-height: 400px;
        overflow-y: auto;
    }
</style>

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

Deleting lines from JSON object using Angular or JavaScript

On my webpage, I have a list where you can add a new line by pressing the "+" button (easy with push), but I'm not sure how to remove lines using the "X" button. https://i.stack.imgur.com/nm06A.png This is the JSON structure: "priceExtra" : [ ...

Is there a way to switch the sorting order on a Bootstrap page using a button without having to refresh the page?

I'm currently working on a template for an app that already exists and would like to add a button to change the sort order of displayed elements on a webpage. The page is styled using Bootstrap 5.3, so I have access to jQuery and other Bootstrap featu ...

Encountering net::ERR_SSL_PROTOCOL_ERROR while trying to access the Nextjs dev server using an IP address

Upon running my Nextjs project with npm run dev, I encountered an issue while accessing the app via http://localhost:3000. The resources were loaded using the HTTP protocol, such as http://localhost:3000/js/dmak_normal.js. However, when attempting to acce ...

Trigger an animation function with JQuery once the first one has finished

I am attempting to create a step-by-step animation of a div in JQuery. Each animation is triggered by a click, followed by a double-click, and so on. My issue arises when the animations overlap. When I double-click the div, both the first and second anima ...

How can I maintain the consistent speed of the Javascript timer even when the .deck is clicked?

Currently, I'm working on creating a memory card game. In this game, the deck of cards is represented by the class .deck. Strangely enough, every time I click on a card, the timer starts to speed up instead of keeping a consistent pace. How can I tack ...

The issue with CSS z-index not functioning properly when using absolute positioning

Here is the issue I'm facing: I have multiple div containers in my code. .outer { position: relative; z-index: 1; } .inner { position: absolute; z-index: 999; } <div class="outer"> <div class="inner"> <div class="option ...

Troubleshooting a live chat box for CSS alignment issues

Need help with aligning a live chat box on every webpage? Check out this example for reference: You can find my code here: https://jsfiddle.net/fn77d0de/2/ ...

What is the best way to implement the settimeout method in react?

I need assistance on how to effectively utilize the setTimeout() method in my code. Specifically, I am looking to trigger a click event on an element after a certain delay and execute a function afterwards. Here is the current implementation of my code: ...

Generating variable names dynamically in JavaScript

To prevent a javascript heap issue, I implement the usage of multiple arrays including 'family1', 'family2','family3' and 'dogs1', 'dogs2', 'dogs3'. For instance, you can use 'family1 and dog ...

Angular error: 'service not defined' factory issue

Looking for help with setting up an Angular factory to store animation functions. When I attempt to do so, I keep getting 'service is not defined' error in the console. For reference, here's a codepen link: http://codepen.io/tplummerptc/pen/ ...

Rendering v-html in VueJS requires a delayed binding value that can only be triggered by clicking inside and outside of a textarea control

I'm currently experiencing an issue with a textarea that is bound to a v-model with a specific value. The problem arises when the content of the textarea is changed via JavaScript - the displayed value, represented by {{{value}}}, doesn't update ...

What Makes Sports Illustrated's Gallery Pages Load So Quickly?

After thoroughly examining their code, I'm still puzzled. Are they loading complete new pages, or are they utilizing jQuery to modify the browser's URL while keeping most of the page unchanged? I'm currently inspecting the source of this pa ...

fa-arrow-circle-o-down and fa-arrow-circle-down

Is it possible to modify the fa-arrow-circle-o-down icon to have the same arrow type as the fa-arrow-circle-down icon? The current arrows on these two icons are different and I want them to be consistent. ...

Choose an XPath formula that will target every single element, text node, and comment node in the original sequence

How can we write an XPath expression that selects all elements, text nodes, and comment nodes in the order they appear in the document? The code below selects all elements but not text nodes and comment nodes: let result = document.evaluate('//*&apo ...

Mastering Angular Protractor for End-to-End Testing

Currently working on an end-to-end test for my Angular application using Protractor. While I can mock httpBackend for unit tests, I prefer to make actual server calls and test against the JSON response. Despite researching on stackoverflow, I'm still ...

Issues with selecting elements in AngularJS using CasperJS

I have attempted all solutions provided in the following link: How to fill a select element which is not embedded in a form with CasperJS? , as well as explored many other sources. The issue I am facing is that I am unable to modify the code below to inclu ...

WebSocket - "Port is already being utilized"

I implemented the files provided in this article: into my codeigniter project, but I keep encountering an error: Message: socket_bind() [function.socket-bind]: unable to bind address [48]: Address already in use The JS section shows me: Connecting... C ...

Customizing skin CSS for DNN Portal and Page images

Currently, I have a unique custom skin that I personally created. It is implemented on multiple portals that I am responsible for managing. My goal is to incorporate the ability for the header image to change based on the specific page being viewed. The he ...

Restrict Recursive GraphQL Schema Query Depth with graphql-sequelize resolver in Node.js using express-graphql

In my code, I have two models called User and Post. My goal is to retrieve User information when querying a post, as well as obtain all of a User's posts when querying a user. These two models are associated in the following manner: User.hasMany(Pos ...

Is Babel necessary for a Node.js server application, and what are the benefits of using it?

My fondness for ES6 syntax and its new object-oriented style makes coding much easier for me. However, as a newcomer to JavaScript, I am curious about the advantages and disadvantages of using Babel in terms of performance, maintenance, readability, and ...