Read full article on the Infragistics blog In Angular, you can pass data from parent component to child component using @Input() decorator, and a child component can emit an event to a parent comment using @Output() decorator. The purpose of this blog post is to explain you whether it is pass by reference or pass by value in context of @Input() and @Output decorator. To start with, let us assume that we have two components, as listed below: As you see, we have two input properties. In data property, we will pass an object. In count property, we will pass a number. From the AppComponent, we are passing value for both properties, as shown below: As you see, we are passing data (object) and count( number) to the child component. Since data is being passed as object, it will be "Pass by Reference" and, since count is passed as number, it will be "Pass by Value". Therefore, if passing an object, array, or the like, then it is Pass by Reference, and for primitive types like number, it is Pass by Value.


I guess you came to this post by searching similar kind of issues in any of the search engine and hope that this resolved your problem. If you find this tips useful, just drop a line below and share the link to others and who knows they might find it useful too.

Stay tuned to my blogtwitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.


This article is related to


angular,Javascript