Angular 6 How to pass array in one component to other [closed]












-3















I want to get data from textboxes and show them in table. But the textboxes are in other component and table is in the other component means table is children, so how can we pass data from textboxes to table?










share|improve this question















closed as off-topic by gustavohenke, David Walschots, Vega, Nkosi, Shree Jan 1 at 10:07


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – gustavohenke, David Walschots, Shree

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 2





    Just read the documentation.

    – David Walschots
    Jan 1 at 9:52
















-3















I want to get data from textboxes and show them in table. But the textboxes are in other component and table is in the other component means table is children, so how can we pass data from textboxes to table?










share|improve this question















closed as off-topic by gustavohenke, David Walschots, Vega, Nkosi, Shree Jan 1 at 10:07


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – gustavohenke, David Walschots, Shree

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 2





    Just read the documentation.

    – David Walschots
    Jan 1 at 9:52














-3












-3








-3








I want to get data from textboxes and show them in table. But the textboxes are in other component and table is in the other component means table is children, so how can we pass data from textboxes to table?










share|improve this question
















I want to get data from textboxes and show them in table. But the textboxes are in other component and table is in the other component means table is children, so how can we pass data from textboxes to table?







angular






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 9:53









David Walschots

8,25452648




8,25452648










asked Jan 1 at 7:01









ZaIn KhAnZaIn KhAn

154




154




closed as off-topic by gustavohenke, David Walschots, Vega, Nkosi, Shree Jan 1 at 10:07


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – gustavohenke, David Walschots, Shree

If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by gustavohenke, David Walschots, Vega, Nkosi, Shree Jan 1 at 10:07


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – gustavohenke, David Walschots, Shree

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 2





    Just read the documentation.

    – David Walschots
    Jan 1 at 9:52














  • 2





    Just read the documentation.

    – David Walschots
    Jan 1 at 9:52








2




2





Just read the documentation.

– David Walschots
Jan 1 at 9:52





Just read the documentation.

– David Walschots
Jan 1 at 9:52












1 Answer
1






active

oldest

votes


















0














Since this a parent-child relationship between two components, you can create an @Input property in your Child Component and pass it from the Parent Component template:



Something like this:



Template of Parent Component:



<app-table
*ngIf="data.length"
[data]="data">
</app-table>


Child Component:



import { Component, Input } from '@angular/core';

@Component({...})
export class TableComponent {

@Input() data: any;

}





Here's a Working Sample StackBlitz for your ref.







share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Since this a parent-child relationship between two components, you can create an @Input property in your Child Component and pass it from the Parent Component template:



    Something like this:



    Template of Parent Component:



    <app-table
    *ngIf="data.length"
    [data]="data">
    </app-table>


    Child Component:



    import { Component, Input } from '@angular/core';

    @Component({...})
    export class TableComponent {

    @Input() data: any;

    }





    Here's a Working Sample StackBlitz for your ref.







    share|improve this answer




























      0














      Since this a parent-child relationship between two components, you can create an @Input property in your Child Component and pass it from the Parent Component template:



      Something like this:



      Template of Parent Component:



      <app-table
      *ngIf="data.length"
      [data]="data">
      </app-table>


      Child Component:



      import { Component, Input } from '@angular/core';

      @Component({...})
      export class TableComponent {

      @Input() data: any;

      }





      Here's a Working Sample StackBlitz for your ref.







      share|improve this answer


























        0












        0








        0







        Since this a parent-child relationship between two components, you can create an @Input property in your Child Component and pass it from the Parent Component template:



        Something like this:



        Template of Parent Component:



        <app-table
        *ngIf="data.length"
        [data]="data">
        </app-table>


        Child Component:



        import { Component, Input } from '@angular/core';

        @Component({...})
        export class TableComponent {

        @Input() data: any;

        }





        Here's a Working Sample StackBlitz for your ref.







        share|improve this answer













        Since this a parent-child relationship between two components, you can create an @Input property in your Child Component and pass it from the Parent Component template:



        Something like this:



        Template of Parent Component:



        <app-table
        *ngIf="data.length"
        [data]="data">
        </app-table>


        Child Component:



        import { Component, Input } from '@angular/core';

        @Component({...})
        export class TableComponent {

        @Input() data: any;

        }





        Here's a Working Sample StackBlitz for your ref.








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 1 at 7:51









        SiddAjmeraSiddAjmera

        15.6k31239




        15.6k31239

















            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith