JavaScript AngularJS ng-repeat in this model

I want to know if it is possible to use ng-repeat in a model that look like this:

Example Model:

$scope.items = {
   item1:{[1,2,3,4,5]},
   item2:{[a,b,c,d,e]},
   item3:{[a1,b2,c3,d4,e5]}
};

The table should like this using ng-repeat:

-------------------------
| Item1 | Item2 | Item3 |
-------------------------
|   1   |   a   |   a1  |
|   2   |   b   |   b2  |
|   3   |   c   |   c3  |
|   4   |   d   |   d4  |
|   5   |   e   |   e5  |
-------------------------

If it is not possible using this model, can you please suggest some alernatives? Any help will be greatly appreciated. Thanks in advance.

Answer:1

You can change the data model like this

function Ctrl($scope) {
    $scope.items = [{
        item1: 1,
        item2: 'a',
        item3: 'a1'
    }, {
        item1: 2,
        item2: 'b',
        item3: 'b2'
    }, {
        item1: 3,
        item2: 'c',
        item3: 'c3'
    }, ...];
}

<div ng-app ng-controller="Ctrl">
    <table>
        <tbody>
            <th>item1</th>
            <th>item2</th>
            <th>item3</th>
            <tr ng-repeat="item in items">{{item}}
                <td>{{item.item1}}</td>
                <td>{{item.item2}}</td>
                <td>{{item.item3}}</td>
            </tr>
        </tbody>
    </table>
</div>

DEMO

Answer:2

I am trying to create textboxes inside <div id="screens"> </div>. I have a drop down menu for which I select the number of textboxes to be created. The JavaScript code I've written here ...

I am trying to create textboxes inside <div id="screens"> </div>. I have a drop down menu for which I select the number of textboxes to be created. The JavaScript code I've written here ...

  1. create text field dynamically javascript
  2. create text file dynamically in c#
  3. create text box dynamically in asp.net
  4. unity create text dynamically
  5. create text file dynamically in ssis
  6. create text file dynamically in java
  7. create static text dynamically mfc
  8. create text field dynamically
  9. create textbox dynamically in c#
  10. dynamically create text file in php
  11. jquery create input text dynamically
  12. javascript create input text dynamically
  13. dynamically create text boxes asp.net c#
  14. dynamically create text file javascript
  15. create kendo textbox dynamically
  16. dynamically create textbox in jquery

I'm using gridster to make a grid of links. The link should work normal when click on it. Problem is it's also get clicked after dragged. How can I stop it from being clicked after dragged? Please ...

I'm using gridster to make a grid of links. The link should work normal when click on it. Problem is it's also get clicked after dragged. How can I stop it from being clicked after dragged? Please ...

  1. prevent click while dragging
  2. jquery prevent click while loading
  3. jquery prevent click while animating

I'm using angularjs 1.3.2. How to get clipboard data on paste event? This question is like: "Paste" event in Angular [ngPaste] But in this question, the angularjs version is 1.2. And this ...

I'm using angularjs 1.3.2. How to get clipboard data on paste event? This question is like: "Paste" event in Angular [ngPaste] But in this question, the angularjs version is 1.2. And this ...

  1. paste clipboard data javascript
  2. paste clipboard data vba
  3. paste clipboard data in c#
  4. paste clipboard data to excel c#
  5. paste clipboard data
  6. clipboard data not suitable for paste

My replace all function is as below, it is in commonHelper.js file exports.replaceAll = function (find, replace, str) { return str.replace(new RegExp(find, 'g'), replace); } Then I do following ...

My replace all function is as below, it is in commonHelper.js file exports.replaceAll = function (find, replace, str) { return str.replace(new RegExp(find, 'g'), replace); } Then I do following ...

  1. search replace javascript
  2. location.search.replace javascript
  3. search replace string javascript
  4. search and replace javascript regex
  5. regex search replace javascript
  6. javascript search replace all
  7. javascript search replace text
  8. javascript search replace array
  9. search and replace html javascript
  10. str search and replace javascript
  11. javascript search replace characters