Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
Angular/general front-end - should components "open a dialog"?

Assuming MatDialog or any "dialog opening service" implementation, where a dialog is opened with dialogService.open, would the "dialog opening logic" be suited in the component itself, or in a Store library (NGRX) effect?

component.ts

foo(): void {
  this.dialogService.openDialog(BarDialog, params)
}

vs

component.ts

foo(): void {
  this.store.dispatchAction(OpenBarDialog, params)
}

and the Effect would have the "dialog opening logic". My intuition is that "opening a dialog is a side effect".

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I don’t think there is a specific single answer to this question, it all comes down to what you need. Here’s my two cent that I absolutely mean as a matter to discuss about (!)

Having this logic in an effect makes this a lot easier to refactor and reuse eventually. If the „answer“ to this dialog (reacting to eg close-action) however is only meant to be consumed by the component you started to open the dialog with, then why abstract everything into an effect in the first place?

On the other hand if you go all the way with NGRX you eventually end up with code that’s a lot more readable and reasonable.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!