Multi-line auto-suggest list with typeahead functionality

Currently, I am utilizing typeahead with Twitter Bootstrap and AngularJS. The autocomplete suggestions are displayed in a single line, as seen in the screenshot below. However, I would like to have the big cities' names displayed on separate lines. For example, I want "London Borough of Harrow" to be shown in two lines when using Twitter Bootstrap's typeahead feature. How can I achieve this? Any assistance would be highly appreciated. I am implementing this functionality through http://angular-ui.github.io/bootstrap/.

Answer №1

To create a line break, simply insert a <br> tag at the desired location.

Answer №2

you can use a template for this purpose

<input id="id" type="text" name="name" ng-model="binding" typeahead-min-length="0" uib-typeahead="x as x.name for xyz in alphabet" typeahead-popup-template-url="url/to/template" typeahead-editable="false" autocomplete="off" typeahead-on-select="yourMethodCall()" ng-change="yourMethodCall()">

inside your template file, let's say some_template.html

<div class="design class" aria-hidden="{{!isOpen()}}">
    <div class="container" ng-repeat="match in matches">
      <div> insert your design here... </div>
  </div>
</div>

and just like that, you're all set!

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

Struggling to keep up with responsive behavior on a page featuring vertically and horizontally centered content that spans the full height

I'm working on a full-height website and the first section needs to have both vertical and horizontal centered content. The issue I'm facing is that there's an image included, which doesn't scale responsively when the screen size change ...

using absolute URLs for image source in JavaScript

How can I output the absolute URLs of images in a browser window (e.g., 'www.mysite.com/hello/mypic.jpg')? Below is a snippet of my code: $('img').each(function() { var pageInfo = {}; var img_src = $(this).attr('s ...

The controller element in AngularJS becomes undefined when invoked within a directive

Presented below is a snippet of my controller: myApp.controller('WizardController', function ($scope, $http) { $scope.user = { addressline1: null, cobuyer: null, validate: null, cobuyerfirstname: null, cobuyerlastname: null, ...

Utilizing an Object in Option Select with ngModel

Currently, I am working on creating a date-time selector in Angular and facing challenges with incorporating an object using ng-model. My dilemma lies in utilizing a hash of hours that have values ranging from 1 to 12, each corresponding to 'AM' ...

"Utilizing a custom CSS style for a half heart rating system

I am currently working on implementing a rating system using the font-awesome fa-heart class. While I have successfully colored the full heart, I am facing difficulty in filling only the first half of the heart in red. Despite my research efforts, all solu ...

Altering the background-color of the navigation bar based on the current

As a newcomer to the Angular framework, my current objective is: To dynamically change the background color of my navbar while scrolling on the homepage, and have it maintain a fixed background color when navigating to other pages. To accomplish this goa ...

Printing a specific column of a particular row in an HTML table to the printer: Tips and tricks

How can I print a specific column from a particular row in an HTML table? I've attempted various CSS and jQuery methods I found online, but none of them seem to be effective. ...

Include an additional phase within the MUI stepper and customize the styling

I am in need of modifying the code below to suit my requirements: Firstly, I would like to change the design from the current one to this: https://i.stack.imgur.com/3RhsH.png The new design will look like this: https://i.stack.imgur.com/sGLwH.png Addi ...

A pale tooltip with a light arrow appearing against a soft white backdrop

Can someone help me figure out how to display a white tooltip with a white arrow? I've tried to implement it using the code below, but the white color is not visible against the background. Any suggestions on making it stand out? $(function () { ...

Utilizing a Bootstrap column design with two columns in place - one column set at a fixed width while the second column stretches across the remaining

Need help with adjusting two columns on a webpage? The right column is fixed at 300px width, while the left column should take up the remaining space. Using flex works well, but when adding a responsive ad to the left column, it extends beyond the availabl ...

Unit testing in Angular JS is crucial, especially when testing functions in services that do not return any values

Apologies if this has been asked before, but I couldn't find a solution to my issue. I need to create tests for a service within an Angular JS application. The main function of the service returns and is used as an external method. There are also a ...

Issues with the functionality of the bootstrap modal jQuery function in Firefox, causing problems with scrollbars and dynamic modal height adjustments

My newly launched website is built using bootstrap v3 and modals to showcase detailed information about each game server that is queried. Each modal provides insights into the current players on the server, their score, and play time. While implementing ...

Is there a way for me to adjust my for loop so that it showcases my dynamic divs in a bootstrap col-md-6 grid layout?

Currently, the JSON data is appended to a wrapper, but the output shows 10 sections with 10 rows instead of having all divs nested inside one section tag and separated into 5 rows. I can see the dynamically created elements when inspecting the page, but th ...

What's causing my text to slowly appear while my HTML canvas remains static and unchanged?

Can someone take a look at my code: http://jsfiddle.net/7y9Gp/2/ I've been struggling with trying to fade in and out text or images, but for some reason, my canvas object refuses to cooperate. I've tried swapping the position of the canvas with ...

Adjusting the height of an Angular CDK virtual scroll viewport based on dynamic needs

Currently, I am developing an Angular table with the cdk Virtual Scroll feature. Is there a method to adjust the scroll viewport's height dynamically? While the standard style property works, I am encountering difficulties setting the value using ngSt ...

Attempting to call a Struts 2 action class from AngularJS using an HTTP GET request, however, no response is being received

I have been working on a simple application that involves making a call to Struts 2 through AngularJS. The process includes sending an HTTP GET request from AngularJS to fetch JSON data from the server. On the server side, I have created an action class na ...

The mysterious height phenomenon when setting the width of a list item with jQuery

Consider a basic ul and li setup similar to this: <div id="middle"> <ul> <li> <a> bridal </a> </li> //.... </ul> </div ...

Retrieve the scope object using angular.element and the $ID parameter

In order to transfer data from an angular application to scripts that operate outside of angular, I am seeking a solution since I cannot modify the code of the angular app. By utilizing Angular Batarang and NG-Inspector extensions in Chrome, I have identi ...

The data for my registration is not getting stored in the Firebase database as expected

I'm currently working on a registration app and it's my first time using firebase. My email address is successfully stored in the authentication section of firebase. However, when I try to connect my app to the database to store additional infor ...

What is the best approach to send data to the parent when closing $mdDialog?

When I open a Dialog Window, it has its own controller. Is there a way for me to modify data in the differentController that belongs to the Dialog Window and then send the modified data back to the parent controller when the dialog is being removed? fun ...