Ahmad Habib
Ahmad Habib

Reputation: 2382

Get dispatched NGRX item in browser console

I am new in NGRX and i am using it in Angular2+ app.

I have 2 components CREATE and READ. I am using NGRX to dispatch a message string on click event from CREATE COMPONENT. I dispatch string message to NGRX STORE from CREATE COMPONENT and show that string message in READ COMPONENT's HTML FILE successfully, like

{{message | async}}

But now i want to get same string in my console and when i console same message variable of READ COMPONENT in READ COMPONENT's TS FILE, i get an object of store whereas i want to get the same string which is being displayed in READ COMPONENT's HTML file.

Is there a method to do this?

Upvotes: 0

Views: 81

Answers (1)

Ininiv
Ininiv

Reputation: 1325

message is be an observable, you should subscribe for it in the component.ts file

message.subscribe((msg) => {
 console.log(msg):
})

Upvotes: 1

Related Questions