Tips for organizing wells within bootstrap into separate columns

Looking for a way to organize my well list into two separate columns. I've included a link to my Plunker project here: https://plnkr.co/edit/35oC9Eochk6EPgKeI9he?p=preview.

Below is the view section:

  <div class="well well-lg" ng-repeat="(key, data) in myData.config.A" style="width:500px;">{{key}}</div>
        </div>

And this is the controller snippet:

$scope.myData={
  "_id": "ui",
  "config": {
    "A": {
      "aaaa": {
        "required": true,
        "editable": true
      },
      "bbbbb": {
        "required": true,
        "editable": true
      },
      "ccccc": {
        "required": true,
        "editable": false
      },
      "ddddd": {
        "required": true,
        "editable": true
      },
      "eeeee": {
        "required": true,
        "editable": true
      },
      "fffff": {
        "required": true,
        "editable": true
      }
    }
  }
}  
});

My goal is to have columns with aaa, bbb, ccc on one side and ddd, eee, fff on the other. Any suggestions on how to achieve this layout?

Answer №1

One method to achieve this is by utilizing Bootstrap's Grid System with the row.column setup.

The ng-repeat can be controlled using $index, allowing you to selectively choose which data to display using ng-show. This enables two-column display of the data.

Feel free to check out the updated Plunker link:

Updated Plunker.

Additional Note: If desired, you have the option to customize and use a different system for column layouts instead of relying on the bootstrap grid system.

Answer №2

To create a layout with 2 columns, you can utilize the col-xs-6, col-sm-6, col-md-6, or col-lg-6 classes within the class attribute of your repeated element.

For example:

<div class="well well-lg col-xs-6" ng-repeat="(key, data) in myData.config.A" style="width:500px;">{{key}}</div>

However, keep in mind that maintaining a specific order while iterating over key/value pairs in objects may not be guaranteed due to the inherent nature of JavaScript engines handling objects differently. If order is essential, consider using an array instead and sorting it accordingly.

For instance: ['aaaa', 'ddddd', 'bbbb', ...]

<div class="well well-lg col-xs-6" ng-repeat="data in myData" style="width:500px;">{{data }}</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

A guide on removing a database row using Angular and PHP

I am currently working on a project that involves the combination of Angular and PHP. One issue I have encountered is when trying to delete a row from a list of customers displayed on an HTML page. Despite clicking the "delete" button, no deletion occurs, ...

What causes the gap between a parent div and inner div in react components?

I have a relatively simple React component that I'm working on. Even though I am quite new to React, I have tried various methods to eliminate the white space issue but so far have been unsuccessful in determining what is causing it. Negative margin s ...

Explore an object to locate an element along with its parent

Here is an example of an object: $scope.categories = [ { value: 'One', id: 1, childs: [ { value: 'Two', id : 2, childs: [ { v ...

Problem with keyframe animations in Internet Explorer 10

My CSS animation works flawlessly in all modern browsers, except for IE10 which is causing some trouble. It appears that IE is having difficulty properly rotating 360deg. I am still searching for a workaround that won't compromise the functionality in ...

Creating a responsive navigation menu using Bootstrap 4 by merging data from various MySQL tables

I am struggling to create a bootstrap 4 nav-menu using the provided SQL query and code snippets. Below are the tables: TABLE menu -------------------------------------- | id | title | url | | 1 | Home | index.php | | 2 | M ...

Align the body of the table with the header after populating the table with values

Issue : The data in the table body is misaligned with the headers of each column. Solution : var test_insert1 = '<tr>' + '<td class="td-trad-9">762261</td>' + '<td class="td-trad-7">1.16176&l ...

Utilizing Angular JS within a callback function from an external source

After updating my Angular 1.3 application to version 1.6, I noticed that a couple of functions are no longer working properly. These functions are used within a vanilla JS script called from a controller to navigate to another controller and view. Below ...

Having difficulty implementing two-way binding on SELECT element within Angular JS programmatically

Struggling with implementing two-way binding for SELECT elements. Attempting to dynamically change the selected element through code. While I've come across examples on Stackoverflow for binding the change event for SELECT, finding resources on the ap ...

What is the best way to split an array into four columns and allocate 10 <li> items from the array to each column?

If I have a dynamic array with 40 elements that changes on every render, how can I loop through the array and return 4 groups of elements, each containing 10 items without any repetition? I want to style these objects in the array using a parent flex con ...

"Unlock the secrets to commanding respect in the web form layout by mastering the art

I have a fieldset that includes a legend with potentially long text content. I need the legend to only take up 50% of the width of the fieldset. Currently, when the legend is too lengthy, it still occupies 50% of the space but causes the entire fieldset ...

Broken links detected in the Full Page Navigation menu on a one-page website

The hyperlinks on this particular page seem to be malfunctioning despite the fact that the li.a tags are correctly targeting specific section IDs. Markup: <header> <a href="#0" class="nav_icon"><i></i></a> </header> ...

How to accentuate search results using Angular filters and conceal non-matching text?

Recently, I came across an interesting example of using Angular filter to highlight search results. It works well in highlighting the word 'suit', but I noticed that all non-matching text remains visible. If you'd like to see the example I ...

What steps can be taken to prompt the layout to transition?

I have an element that sticks to the top based on the current scroll offset. The issue is that the layout doesn't update when there is space available after the stuck element. This creates a ghost gap where the stuck element used to be... http://fidd ...

Creating a dynamic and flexible div using CSS

I am currently working on a small webpage and encountering an issue with responsiveness when scaling the browser window in and out. The design looks perfect at 320x568 resolution, but when I scale it down, a black box (`.transbox`) overlaps the image, whic ...

Adjust the opacity of certain elements to be semi-transparent, with the exception of the one currently

I'm attempting to implement the :not selector in conjunction with :hover to create a visual effect where elements that are not being hovered over become semitransparent. My goal is as follows: 1) All elements start at 100% opacity 2) When an elemen ...

Does AngularJS have a feature similar to jQuery.active?

As I utilize selenium to conduct tests on my application, I am encountering numerous ajax calls that utilize $resource or $http. It would be convenient if there was a method in angular to monitor active ajax requests so that selenium could wait until they ...

Incorporate the ng2-ace library into a newly generated Angular-CLI (Angular2) project with the help of SystemJS

After setting up my angular2 project using the latest angular-cli tool, I decided to integrate the ace editor with the help of the ng2-ace library. My goal was to implement this in a clean manner using SystemJS as the module loader. I started by running ...

Is it possible to have a hover box with no spacing in between?

I am currently designing a navigation bar and I want to implement a feature where hovering over each link will display the box/background color without any space in between of Home, About Us, etc. For reference, you can check out this example here: http:/ ...

Adjusting the height of a div according to the changing heights of other divs

The sidebar contains a search field, two lists, and a text div. The height of the search field and text div always remains constant, while the heights of the two lists vary dynamically. I am exploring the possibility of using only CSS to make the height o ...

AngularJS is failing to display additional or reduced content as desired

I have a small code snippet that is not functioning as expected. I am trying to toggle the visibility of a paragraph based on button click. <div ng-init="more = false" ng-app="ang_app" ng-controller="CtrMain"> <p ng-class="{'showMore' ...