Adjusting Bootstrap 3 button group widths dynamically with ng-repeat

While utilizing a static method to display all radio buttons, everything works smoothly with 100% width. However, when I switch to a dynamic approach using ng-repeat, a line break issue arises.

When not using ng-repeat:

When using ng-repeat:

Here's the code snippet:

<div class="btn-group input-group btn-group-justified" ng-repeat="number in numbers">
    <label class="btn btn-primary" ng-model="radioModel" btn-radio="'{{number}}'">{{number}}</label>
</div>

View the Example Here

Answer №1

http://plnkr.co/edit/LFiWKeAdL5FMDrRmpLoP?p=preview

relocate ng-repeat inside <label>

   <div class="btn-group input-group btn-group-justified">
      <label class="btn btn-primary" ng-model="model.radioModel" btn-radio="{{number}}" ng-repeat="number in numbers" ng-init="model =$parent" name="radio">{{number}}</label>

    </div>

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

Tips for designing table rows with varying column lengths using CSS and JavaScript

I am facing an issue while populating my table with data from a list. Currently, the table cells are being filled from left to right, but I want them to be populated from top to bottom. Unfortunately, I am unsure how to achieve this using a list method. ...

I attempted to increase the value in an array by using the push() method, but I am uncertain about the proper way to do

I have this code that I'm using to organize the staff members in company1, but it seems to be creating a new list of arrays. Can someone assist me with this issue? Once I add the name and ID of the staff, the array will appear as follows: [{compan ...

Example using Three.js Collada: "file is either empty or does not exist"

I am currently troubleshooting the Three.js Collada loader example. I have successfully run other samples, including the .obj loader and blender scene, by running a local http server to load images for textures and models. However, when attempting to run t ...

Unveiling the method to retrieve AuthErrorCode from Firebase JS SDK without the need for the auth/ prefix

I'm curious about how to retrieve the correct error code in Firebase v10. public resetPassword(email: string, actionCodeSettings: ActionCodeSettings): Promise<void> { return sendPasswordResetEmail(this.auth, email, actionCodeSettings); } publ ...

Incorporate data from a CSV file into an HTML table on the fly with JavaScript/jQuery

I have a CSV file that is generated dynamically by another vendor and I need to display it in an HTML table on my website. The challenge is that I must manipulate the data from the CSV to show corrected values in the table, only displaying products and not ...

Populating check boxes in a jQuery multiselect dropdown based on option text

I want to implement the jQuery multiselect plugin, but the checkboxes are appearing after the option text. Is there a way to configure them to be on the left side? https://i.sstatic.net/2oB2y.png ...

Unable to locate the specified script using node.js

Recently, I've started working with Javascript and Node.js. My current project is utilizing OpenMCT (https://github.com/nasa/openmct) and I'm facing an issue when trying to integrate a script as a plugin in an index.html file. Upon starting the N ...

How can I eliminate the hover effect from a div element?

I am facing an issue with implementing a zoom effect on hover for my list of products. When I do a long press on a product, it works the first time but not the second time. I suspect this is because the div remains in a hover state. I want to ensure that ...

What are some ways to reuse an angular component multiple times?

I am utilizing an angular component to dynamically load charts into my widget: Below is an example of the component: angular.module("generalApp").component("chartPie", { template: "<div class=Pie></div>", bindings: { data: "=", }, control ...

The problem in React arises when the event.target becomes undefined or null

I'm currently using React Hooks and I have encountered an issue while trying to update the state within a function that utilizes event.target and event.name. The problem arises as the event object within the handling function returns undefined for bo ...

execute a function upon selecting a radio button

Below is the HTML code that includes two radio buttons. The default checked button is the "lease" option. <input id="quotation_request_payment_option_lease" class="choose_payment_option" name="quotation_request[payment_option]" type ...

Chrome seems to be having trouble connecting via socket.io, while Firefox and Safari are able to do so without any issues. Some strange

I've been setting up a socket.io implementation for nodejs. Everything runs smoothly on most devices across various browsers, but I'm encountering an issue with Chrome on certain devices. It fails to connect to the socket server, showing this er ...

Capture all div elements from the table and store them in an array

Check out this code snippet that includes draggable divs and a droppable table: http://jsbin.com/exetuk/1/edit When dragging a div to the table, copies of the div with the class .draggable appear. I am looking to create an array with divs from the table ...

What is the best way to calculate the number of squares required to completely fill a browser window in real-time?

I am creating a unique design with colorful squares to cover the entire browser window (for example, 20px by 20px repeated both horizontally and vertically). Each square corresponds to one of 100 different colors, which links to a relevant blog post about ...

How can I ensure the Jquery datepicker functions correctly?

I've been attempting to create a jsp page with some Jquery functionalities. Unfortunately, despite my best efforts, I am unable to make it work. I have downloaded jquery1.7.1 and jquery-ui1.8.17 (non-mini), renamed them to jquery171.js and jquery-ui. ...

"Encountering a JavaScript Issue While Displaying an iFrame

Having trouble displaying an iframe on a ColdFusion website when passing values in the URL. A similar method worked fine on a non-ColdFusion site, so I suspect the issue is with ColdFusion itself. Unfortunately, I have no experience with ColdFusion. If I ...

Guide on effectively exporting an NPM module for all browsers:

I have developed an NPM module which looks like this: class MyModule { // code here }; I am interested in making the export of MyModule universal, so that users can easily import it using any of the top 3 popular methods in the Browser: Using ES6 I ...

The Elusive Solution: Why jQuery's .css() Method Fails

I am currently facing an issue with my code that utilizes the jQuery .css() method to modify the style of a specific DIV. Unfortunately, this approach does not work as expected. To illustrate the problem, I have provided a simplified version of my code bel ...

Utilize the ui-sref directive to create a link with a parameter (?key=val) included

Currently, I am utilizing Angular ui-router and my state is structured as follows: .state('detail', { url: '/detail/{id}', When creating links in the HTML file, I find it more convenient to use the ui-serf directive. Here's a ...

Is there a way to maintain view content despite changes in state?

Is there a way to maintain content from the named ui-view when changing the state? This is essential for achieving a multi-window behavior. Check out the Plunker example provided. I am trying to preserve the content when clicking on main 3 or main 4. < ...