calling a component function from another component using angular 4 ng-smarttable

1,220 views
Skip to first unread message

vishnu siddareddy

unread,
Aug 2, 2018, 3:19:07 AM8/2/18
to Angular and AngularJS discussion

I am using ng2-smarttable for rendering the data in a table and i have implemented the custom button in another component.

 And i want to reload the data once click on the button.


I am getting the error saying, 

ERROR TypeError: Cannot read property 'showData' of undefined

I have added the code in stackblitz.com. Can anyone help on this

Sander Elias

unread,
Aug 4, 2018, 11:12:47 PM8/4/18
to Angular and AngularJS discussion
Hi Vishnu,

You stackblitz seems to miss parts. Can you make it show the error you are experiencing?

Regards
Sander

vishnu siddareddy

unread,
Aug 5, 2018, 4:50:58 AM8/5/18
to ang...@googlegroups.com
@sandar, sorry for my late response and thanks again for your quick response. While page loading first I am calling this function to load the data from sever. 

After button click, I am opening the count down timer in  modal dialog in button renderer component(assume there is a modal). After timer reaches to zero, I am calling the function to reload table again with updated data from server.

I am not able to call function from another component. I have added log inside function(assume this function will get dat.a and render the table)

Getting error while calling function from buttonrenderer component. You can check the error in console of the browser.

Can you please help on this.

Thanks, 
Vishnu

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Sander Elias

unread,
Aug 6, 2018, 1:38:41 AM8/6/18
to Angular and AngularJS discussion
Hi Vishnu ,

Check out @Output. you can use this to "call" a function in a parent.
Reply all
Reply to author
Forward
0 new messages