0

im new to angular, i have a table like this which is having angular data, its not having any controller or model. Its just displaying in html.

    <table  width="98%" border="0" cellspacing="1" cellpadding="2" class="labels" align="center" id="locc">

      <tr style="color:#000;font-size:15px;font-family:Arial, Helvetica, sans-serif;background-color:gold;background-repeat:repeat-x; border: 1px solid #c1c1c1;"
       height="30" >
        <td  width="211"  align="center">COMMODITY / CITY</td>
        <td  width="149" align="center" valign="middle"  >BUY</td>
        <td  width="175" align="center" valign="middle" >SELL</td> 
      </tr>
      <tbody ng-repeat="item in newsData" >
        <div id="comm">
        <tr bgcolor="#FFFFFF" height="40"   >
          <td  align="center" id="commodity" style="border: 1px solid #c1c1c1;color:#000;font-size:15px" >{{item.COMMODITY}}</td>
          <td  align="center" valign="middle" style="border: 1px solid #c1c1c1;color:#000000;font-size:20px" class="{{item.BCOL}}" ><div  >&nbsp;&nbsp;{{item.BUY}}&nbsp;&nbsp;</div></td>
          <td  align="center" valign="middle" style="border: 1px solid #c1c1c1;color:#000000;font-size:20px" class="{{item.SCOL}}"  ><div >{{item.SELL}}&nbsp;&nbsp;</div></td>

        </tr></div>
      </tbody>
    </table>      

The output of the following is like this..

enter image description here

By default its loading all COMMODITY values are displayed by using "repeat",

What i want is only first two COMMODITY to be displayed rest i want to remove.. Please help me to do this.. I want only these two values "GOLD999[IMPORTED][BLR]", "SILVER-30KG[ALL LOCATION]"

1
  • do you mean that you want to show first two row's ? or to display the whole table as is but hide all cell that comes after the second cell inside commodity column just? Commented Dec 10, 2017 at 8:00

1 Answer 1

2

You can use AngularJS limitTo filter as documented here.

In you code

<tbody ng-repeat="item in newsData | limitTo : 2" >
Sign up to request clarification or add additional context in comments.

1 Comment

One more thing.. I want to send this data to display in mobile app.. How can i make this into JSON and send them as a api??

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.