Angular JS has a unique feature of a scrollable drop-up menu that allows

Here is the code snippet for my Dropup component:

<div class="dropup">
   <button class="btn btn-primary btn-raised dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false>
                                                {{selectList.selectedListItem}}
        <div class="ripple-container"></div>
   </button>
   <div class="dropdown-menu">
      <a class="dropdown-item" ng-repeat="list in roleList" href="#" ng-value="list.role" name="{{list.role}}" ng-click="update(list.role, list._id)" id="{{list.role}}" ng-model="selectList" name="selectedList">{{list.role}}</a>
   </div>
</div>

I am applying CSS to the dropdown-menu as shown below:

overflow: scroll;
max-height: 200px;

Unfortunately, this CSS doesn't seem to work for me. Do you have any other solution?

Update: After adding this additional CSS to the dropdown-menu style:

overflow: scroll;
max-height: 200px !important;

My dropdown-menu now appears without scrollable options like this:

Answer №1

For the outermost container, include the following code within the style attribute:

<div class="dropdown-menu" style="height: 300px; overflow: scroll;">

After implementing this adjustment, I saw positive results.

Answer №2

You should consider revising your display method

try this instead

<ul class="dropdown-menu scrollable-dropUp">
   <li><a class="dropdown-item" ng-repeat="list in roleList" href="#" ng-value="list.role" name="{{list.role}}" ng-click="update(list.role, list._id)" id="{{list.role}}" ng-model="selectList" name="selectedList">{{list.role}}</a></li>
 <ul>

then add the following CSS

.scrollable-dropUp{
   overflow: scroll;       /*overflow-x and overflow-y*/
   max-height: 200px !important;
}

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

What are the steps to inject the npm package called lodash as a dependency injection in AngularJS for the angular-google-maps module with the help

I have set up my angular application using npm as the package manager and Browserify to manage libraries. The specific package I am using is angular-google-maps from http://angular-ui.github.io/angular-google-maps. An error message I encountered is: Refe ...

Unable to retrieve data for the initial keystroke in jQuery autocomplete

I'm currently working on setting up jQuery autocomplete with a specific method involving a separate source function and an intermediary variable for data storage. My main goal right now is to successfully pass the data to the source part of the autoCo ...

What could be causing the slowdown in my NodeJS IRC-bot?

Decided to challenge myself today by creating an IRC-bot using JavaScript with NodeJS. So far, everything is functioning correctly, but it seems like there may be a bottleneck somewhere. For instance, when I input a command multiple times, the initial res ...

Tips for splitting the json_encode output in Javascript

Looking for help with extracting specific values from JSON data retrieved via PHP and AJAX. I only want to display the agent name in my ID, not the entire object that includes "name" : "Testing". Here is the console output: [{"agent_module_id":"1","agen ...

When using ng-repeat, make sure to track by $index for unique

After manipulating an array with 5 values (1, 2, 3, 4, 5), it now contains duplicate data (1, 2, 3, 4, 5, 1, 2, 3, 4, 5). I would like to use ng-repeat with $index to display the data without duplicates. Is this possible? ...

ajax modal form editing

Encountered an issue with editing a form using modal ajax, where the edit form pops up but the data remains empty. The code snippet for my controller: public function edit() { $id=$this->uri->segment(3); $data=array( 'project' => $th ...

Installing Karma and Jasmine testing framework for AngularJS using npm has become even easier now that the npm package has undergone a name change

Recently, I have taken on the task of developing an application previously built with AngularJS for its front-end. My goal is to implement automated testing into our development process. After researching various testing frameworks compatible with Angular ...

Customizing AngularJS Scripts to Include Target Blank

I'm feeling a bit lost. I need to include a target="_blank" on my anchor link. The issue is that the anchor tag is linked to a script in angular. I am not familiar with this JavaScript framework. I have tried searching through the documentation for po ...

Assign a value to the input field based on changes made in another input field

I am brand new to the world of JavaScript and currently grappling with setting a value in an input field based on the onchange event of another input field. Here is my code sample for input field 1: <input type='text' onchange='methodTh ...

Tips for inserting a blank space into a text box

It feels like such a simple issue, but my function is incorrectly returning "1" instead of just an empty space "" in my textbox. <td><input type="button" value="Space" name="Space" onClick='document.firstChild.search.value = document.firstCh ...

Ways to update a div periodically with new data fetched from a file - Here's How!

I am looking to auto-refresh a specific div every few seconds on my index.php page below. <?php session_start(); if (! check_write()) { redirect('testlogin.php'); return; } if (file_exists('lmt.json')) { $lmt = json_de ...

Dealing with JSON Stringify and parsing errors in AJAX

I've been troubleshooting this issue for hours, trying various suggestions found online, but I'm still encountering a problem. Whenever I encode function parameters using JSON.stringify and send them to my PHP handler through AJAX, I receive a pa ...

The property length is undefined and cannot be read

I'm currently utilizing a dexi.io robot for the purpose of automating data extraction from permit databases. This particular robot has the capability to process custom JavaScript in order to dissect the incoming JSON object. While this code does func ...

The toggle button requires two clicks to activate

I created a toggle button to display some navigation links on mobile screens, but it requires two clicks upon initial page load. After the first click, however, it functions correctly. How can I ensure that it operates properly from the start? Below is t ...

Issue with URL parameter in React when using React Router

Initially, everything was running smoothly in my React project using react-router-dom. However, once I added another Route like so: <Route path="/edit/:id" component={EditPage}/> and tried changing the URL in the browser to http://localhos ...

Tips for using Jquery to retrieve HTML from external sources

I have successfully managed to display an internal webpage on my HTML, as shown below: <!doctype html> <html> <head> <script type="text/javascript" src="jquery-1.4.4.js"></script> </head> <body> & ...

Getting the string value from query parameters can be achieved by accessing the parameters and

Currently, I am attempting to retrieve the string value stored within a class-based object variable named question5. The way I am trying to access this variable on the front-end is shown below. axios.get("http://localhost:3001/users/questionaire/?getq ...

Benefits of Utilizing Object.create

Unlike the referenced question, this code snippet is sourced from the book "JavaScript: The Definitive Guide". It introduces an inherit method that applies Object.create if available, but falls back to traditional JavaScript inheritance when it's not. ...

Tips for updating the selected date format in a Material Table component using React

In the context of using a material table in React, the columns set up are as follows: columns={[ { title: 'Name', field: 'name', type: 'string', }, ...

From AJAX response to React state attribute, store the JSON data

I have a component where I need to fetch freight values via ajax and store them in the state property of this class. import React, { Component } from 'react'; import Freight from './Freight'; import CreateFreightEntryModal from '. ...