0

I have two table, table 1 and table 2.. Table 1 has a field count. based on the count value(count value= no of rows populated), rows should be automatically populated in table 2. I am new to angularjs. Please let me know how can acheive this

0

2 Answers 2

1

To render values in your table you can use ng-repeat directive.

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

1 Comment

Why you don't provide any simple example..!
0

You can use things such the ngIf, ngShow and ngHide directive to hide or show DOM objects based on an expression, or use ngRepeat to dynamically add additional DOM object based on a growing or shrinking array in your controller.

My guess is you're looking for an visibility directive, so I think the following might help:

<table id="table1">
    <tr data-ng-repeat="row in table1">
        <td>{{row.someData}}</td>
    </tr>
</table>

<table id="table2" data-ng-show="table1.length == 0">
    <tr data-ng-repeat="row in table2">
        <td>{{row.someData}}</td>
    </tr>
</table>

Note that both tables are filled with an ngRepeat by using corresponding arrays from your controller as a source. On the second table, you can see an ngShow directive with an expression that says: "if table1 is empty, show me".

I hope this helps.

Comments

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.