0

how to use object of one component in another component in angular 4 -->i have two components in my app say,component1 and component2 .i need to use object of component1 in component2.can anyone help me out of this problem

  • Have a look at [this](https://stackoverflow.com/questions/45407768/what-is-the-best-way-to-use-nested-components-in-angular-4-and-calling-a-method) SO question. – Jeroen Heier Dec 19 '17 at 04:53
  • There is lots and lots of questions on SO regarding this. Also check out the docs: https://angular.io/guide/component-interaction – AT82 Dec 19 '17 at 06:23

1 Answers1

0

Just import your object ts file in a component in which you want to use your object, assign it to a variable and use it throughout your component independently. import '../objectfile.ts';

Hrishikesh Kale
  • 6,140
  • 4
  • 18
  • 27