0

My code is like this

<table ng-app='myApp'>
    <thead>

    </thead>
    <tbody ng-controller="MainCtrl">
        <tr ng-repeat="prdElement in palletElement">
            <td>{{prdElement.name}}</td>
            <tr ng-repeat="data in prdElement.data">

                <td>
                    {{data.itemId}}
                </td>
                <td>
                    {{data.shipmentId}}
                </td>
                <td>
                    {{data.itemCode}}
                <td>
                    {{data.description}}
                </td>

                <td>
                    {{data.handlingUnit}}
                </td>
                <td>
                    {{data.weight}}
                </td>
                <td>
                    {{data.class}}
                </td>
                <td>
                    {{data.lenght}}
                </td>

                <td>
                    {{data.width}}
                </td>
                <td>
                    {{data.height}}
                </td>
                <td>
                    {{data.flag}}
                </td>

                <td>
                    <input type="text" ng-model="prdElement.quantity" placeholder="Code" required />
                </td>

            </tr>
            <tr>
                <td>
                    <button ng-click="newPalletItem(palletElement,$event)">Submit</button>
                </td>
            </tr>
         </tr>

        </tbody>

    </table>


(function () {
    angular.module('myApp', []).controller('MainCtrl', function ($scope) {

        var counter = 0;

        $scope.palletElement =
        [{
            name: 'Pallet 1',
            Data:[{
            name:'item 1' ,
            itemId: '284307',
            shipmentId: 'eb44f690-c97a-40e3-be2a-0449559e171a',
            itemCode: '',
            description: 'Bicycle parts - frame',
            quantity: '31',
            handlingUnit: 'CTN',
            weight: '613.04',
            class:'',
            lenght: '102',
            width: '42',
            height: '61',
            flag:'P'
        }, {
            name: 'item 2',
            itemId: '284308',
            shipmentId: 'eb44f690-c97a-40e3-be2a-0449559e171a',
            itemCode: '',
            description: 'Bicycle parts - fork',
            quantity: '22',
            handlingUnit: 'CTN',
            weight: '242.99',
            class: '',
            lenght: '75',
            width: '34',
            height: '18',
            flag: 'P'
        }]
        }]

    }
    });
}());

All looks okay to me, but not working, can any one point out what I am doing wrong?

Fiddle

5
  • 1
    If i am not wrong, you are doing a <tr> inside a <tr> . You might have misplaced the tags Commented Oct 9, 2014 at 5:35
  • 1
    Also, {{data.itemCode}} has no ending </td> tag. Commented Oct 9, 2014 at 5:45
  • @LearningNeverStops Okay. Any guess on why its not working? Commented Oct 9, 2014 at 5:47
  • @Athul How about fixed those syntax errors in your fiddle first? Commented Oct 9, 2014 at 5:55
  • @isim Done. Still not working Commented Oct 9, 2014 at 6:20

1 Answer 1

2

Remove ng-controller="MainCtrl" from tbody and add it on table

Change prdElement.data To prdElement.Data and Try

See DEMO

Sign up to request clarification or add additional context in comments.

2 Comments

The ng-controller can remain in the tbody. OP just needs to fix up the javascript syntax error. Also, those nested <tr> elements are malformed.
My own experience with attempting to nest <tr> tags with nested repeaters resulted in the repeater just kind of giving up. No console errors, just the repeater refusing to work. I'm assuming angular has some kind of syntax checking or some such in repeaters, not sure. The solution was to use nested <ul> tags, which is valid and totally fine to do and the repeater doesn't have a problem with those.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.