Angular 2 - send textarea value to a shared component

前端 未结 3 775
孤街浪徒
孤街浪徒 2020-12-20 05:55

I have a textarea in the first page and when i go to next page i need this value to show in a notepad component that is shared in the next pages but at the same time i need

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 06:35

    You can use @Input decorator if there is parent child relationship between components. Else make use of Services or BehaviourSubject. These are the following approaches based on priority:

    1. Using Services(Most Recommended).
    2. Using Behavior Subjects from RxJS library.
    3. Use Redux for state management.
    4. Using browser storage(session/local) but least recommended as prone to data security.

提交回复
热议问题