Bacancy Bacancy
      • About Company
      • Resources
      • Careers

      About Company

      About Us Leadership Team Customer Reviews Awards & Recognition Infrastructure
      Bacancy Values Bacancy Culture Agile Mindset Our Locations Partnership

      Resources

      Blog Infographics Whitepapers
      Insights Media Coverage

      Careers

      Career Job Openings Life@Bacancy
      Events Great place to work
      We are great place to work certified™

      Building and sustaining High-Trust, High-Performance Culture

      Get Quote
    • AI
      AI Consulting AI Development AI/ML Development AI Agent Development
      AI Integration AI Staffing Generative AI AIOps Engineer
      Power Up with AI Implementation

      Bring intelligent automation to your platform with our AI development expertise.

      Get Quote
    • Engagement Models

      Hiring Software Developers becomes easier with just a few clicks.

      Dedicated Developer/Teams

      Hire developers dedicatedly working for your project

      Software Development Outsourcing

      Get custom solution built as per your requirement.

      Staff Augmentation

      Bridge the skill gap in your in-house team

      • Software Engineering
      • Application Development
      • Data Engineering
      • Automation
      • Quality Assurance
      • Cloud
      • DevOps
      • Machine Learning
      • Platforms
      • IT Services
      • SaaS
      • Technologies

      Software Engineering

      Software consulting Software Development Services Enterprise Software Development Custom Software Development Software Product Development Software Development Outsourcing Offshore Software Development

      Application Development

      Web Development Mobile App Development Ecommerce App Development Full Stack Development Application Development Services Application Modernization Services

      Data Engineering

      Data Analytics Data Analysis Data Warehouse Data Migration Data Cleaning Data Visualization Data Collection Data Integration Big Data Business Intelligence Data science consulting

      Automation

      RPA Consulting Workflow Automation

      Quality Assurance

      QA Testing Functional Testing Automation Testing Security Testing Performance Testing

      Cloud Services

      Cloud Services

      Cloud Services and Solution Cloud Migration Cloud Consulting Cloud Integration Cloud Support And Maintenance Cloud Managed

      AWS

      AWS Consulting AWS Migration AWS Managed AWS Integration AWS Support And Maintenance

      Azure

      Azure Consulting Azure Migration Azure Support and Maintenance Azure Managed Azure Integration

      Google Cloud

      Google Cloud Consulting Google Cloud Migration Google Cloud Support and Maintenance Google Cloud Managed Google Cloud Integration

      DevOps

      DevOps

      DevOps Consulting DevOps Automation DevOps Implementation DevOps Containerization DevSecOps Consulting

      Kubernetes

      Kubernetes Consulting

      Machine Learning

      ML Consulting Deep Learning Tensorflow Development ML Development

      Platforms

      Salesforce

      Salesforce Customization Salesforce Implementation Salesforce Integration Salesforce Development Salesforce Consulting Salesforce Appexchange Salesforce CPQ Salesforce Data Migration Salesforce Managed Services Salesforce Staff Augmentation Salesforce App Development Salesforce Classic To Lightning Migration Salesforce Service Cloud Salesforce Marketing Cloud Salesforce Sales Cloud Salesforce Commerce Cloud Salesforce Financial Services Cloud Salesforce Support

      Microsoft

      Microsoft Dynamics Consulting Dynamics 365 Implementation Dynamics 365 Integration Dynamics 365 Customization Microsoft Dynamics 365 Support

      SAP

      SAP Consulting

      IT Services

      IT Consulting IT Staff Augmentation IT Support IT Outsourcing

      SaaS

      Saas Development Saas Consulting Saas Web Design Saas Architecture

      Technologies

      Front End

      Angular React Vue UI/UX

      Back End

      Laravel Python Golang Ruby on Rails Node Java PHP Rust .NET

      Mobile

      React Native Flutter Android

      Advanced Technologies

      Cloud DevOps IoT Big Data Data Science AI/ML
      High-quality, Cost-effective IT Outsourcing

      Schedule a free discovery session to explore your needs and find tailored solutions with no obligation.

      explore all services
    • Industries
      BFSI Oil & Gas Healthcare Industry 4.0
      Real Estate & Construction Logistics Fintech
      Let’s grow together Partner with us Get Quote
      • Frontend
      • Backend
      • Software
      • Mobile App
      • Automation
      • Platforms
      • Artificial Intelligence
      • Machine Learning
      • DevOps
      • Data Science
      • Cloud
      • Web

      Frontend

      Angular Developer React Developer Vue Developer Javascript Developer UI/UX Developer HTML/CSS Developer Tailwind CSS Developer
      Your Very Own UI/UX Architects

      Experience smooth navigation and user-friendly designs with our front-end expertise.

      Hire Frontend Developer

      Back End

      Laravel Developer Python Developer Golang Developer Ruby on Rails Developer Node Developer .NET Developer .NET Core Developer Java Developer Spring Boot Developer R Developer PHP Developer Django Developer Rust Developer C# Developer
      Server Solutions To Change Power Dynamics

      Transform your data into digital experiences with optimized coding standards.

      Hire Backend Developer

      Software

      Software Developer Software Tester Full Stack Developer Offshore Developer Remote Developer
      Dedicated Talent With Skilled Approach

      Bring your digital visions to life with a hired resource at your convenience.

      Hire Dedicated Developer

      Mobile App

      React Native Developer Flutter Developer Ionic Developer Kotlin Developer iOS Developer Android Developer
      Innovating Mobile-Friendly App Solutions

      Create dynamic mobile apps that make your brand stand out from the crowd.

      Hire Mobile App Developer

      Automation

      RPA Developer UiPath Developer
      Automating At The Edge of Efficiency

      Scale your development processes to the edge of automation for improved efficiency.

      Get Quote

      Platforms

      Salesforce Developer MS Dynamics 365 Developer ServiceNow Developer
      Fueling Possibilities of Customer Engagement

      Improving customer engagement with advanced CRM solutions.

      Get Quote

      Artificial Intelligence

      AI Developer ChatGPT Developer Alexa Skill Developer OpenAI Developer Pytorch Developer Prompt Engineer AIOps Engineers
      Combining Today The Tech of the Future

      Dive into the domain of tomorrow and bring the future of AI to today's apps.

      Get Quote

      Machine Learning

      ML Developer Neural Network Developer
      Teaching Your System To Learn And Predict

      Leverage the power of machines and benefit your business with unique ML algorithms.

      Get Quote

      DevOps

      DevOps Developer DevsecOps Developer
      Connecting Development With Operations

      Bridging the gap between development and operations for seamless software development.

      Get Quote

      Data Science

      Tableau Consultant Data Analyst Data Scientist PowerBI Consultant Data Engineer Qlik Developer Automation Anywhere Developer
      Guiding Decisions WIth Data-Driven Insights

      Transition from your gut calls to actionable insights with our rich Data Science expertise.

      Get Quote

      Cloud

      Cloud Developer AWS Developer Azure Developer Google Cloud Developer
      Redefining Scalable Digital Infrastructures

      Make your data accessible worldwide at will, and leave the stress behind.

      Get Quote

      Web

      Web Developer Web Designer Webflow Developer
      Scalable Web Solutions Built For Resilient Performance

      Get highly responsive, user-friendly websites through our end-to-end web design and development expertise.

      Get Quote
  • Portfolio
  • Contact Us
hire developers

Bacancy

Bacancy represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.

12+

Countries where we have happy customers

1050+

Agile enabled employees

06

World wide offices

12+

Years of Experience

05

Agile Coaches

14

Certified Scrum Masters

2500+

Clients projects

1458

Happy customers

  • About Us
      About Company
      • About Us
      • Leadership Team
      • Customer Reviews
      • Awards & Recognition
      • Infrastructure
      • Bacancy Values
      • Bacancy Culture
      • Agile Mindset
      • Our Locations
      • Partnership
      Resources
      • Blog
      • Infographics
      • Whitepapers
      • Insights
      • Media Coverage
      Careers
      • Career
      • Job Openings
      • Life@Bacancy
      • Events
      • Great place to work
  • AI
    • AI Consulting
    • AI Development
    • AI/ML Development
    • AI Agent Development
    • AI Integration
    • AI Staffing
    • Generative AI
    • AIOps Engineer
  • Services
      Software Engineering
      • Software consulting
      • Software Development Services
      • Enterprise Software Development
      • Custom Software Development
      • Software Product Development
      • Software Development Outsourcing
      • Offshore Software Development
      Application Development
      • Web Development
      • Mobile App Development
      • Ecommerce App Development
      • Full Stack Development
      • Application Development Services
      • Application Modernization Services
      Data Engineering
      • Data Analytics
      • Data Analysis
      • Data Warehouse
      • Data Migration
      • Data Cleaning
      • Data Visualization
      • Data Collection
      • Data Integration
      • Big Data
      • Business Intelligence
      • Data science consulting
      Automation
      • RPA Consulting
      • Workflow Automation
      Quality Assurance
      • QA Testing
      • Functional Testing
      • Automation Testing
      • Security Testing
      • Performance Testing
      Cloud

        Cloud Services

      • Cloud Services and Solution
      • Cloud Migration
      • Cloud Consulting
      • Cloud Integration
      • Cloud Support And Maintenance
      • Cloud Managed
      • AWS

      • AWS Consulting
      • AWS Migration
      • AWS Managed
      • AWS Integration
      • AWS Support And Maintenance
      • Azure

      • Azure Consulting
      • Azure Migration
      • Azure Support and Maintenance
      • Azure Managed
      • Azure Integration
      • Google Cloud

      • Google Cloud Consulting
      • Google Cloud Migration
      • Google Cloud Support and Maintenance
      • Google Cloud Managed
      • Google Cloud Integration
      DevOps

        DevOps

      • DevOps Consulting
      • DevOps Automation
      • DevOps Implementation
      • DevOps Containerization
      • DevSecOps Consulting
      • Kubernetes

      • Kubernetes Consulting
      Machine Learning
      • ML Consulting
      • Deep Learning
      • Tensorflow Development
      • ML Development
      Platforms

        Salesforce

      • Salesforce Customization
      • Salesforce Implementation
      • Salesforce Integration
      • Salesforce Development
      • Salesforce Consulting
      • Salesforce Appexchange
      • Salesforce CPQ
      • Salesforce Data Migration
      • Salesforce Managed Services
      • Salesforce Staff Augmentation
      • Salesforce App Development
      • Salesforce Classic To Lightning Migration
      • Salesforce Service Cloud
      • Salesforce Marketing Cloud
      • Salesforce Sales Cloud
      • Salesforce Commerce Cloud
      • Salesforce Financial Services Cloud
      • Salesforce Support
      • Microsoft

      • Microsoft Dynamics Consulting
      • Dynamics 365 Implementation
      • Dynamics 365 Integration
      • Dynamics 365 Customization
      • Microsoft Dynamics 365 Support
      • SAP

      • SAP Consulting
      IT Services
      • IT Consulting
      • IT Staff Augmentation
      • IT Support
      • IT Outsourcing
      SaaS
      • Saas Development
      • Saas Consulting
      • Saas Web Design
      • Saas Architecture
      Technologies

        Front End

      • Angular
      • React
      • Vue
      • UI/UX
      • Back End

      • Laravel
      • Python
      • Golang
      • Ruby on Rails
      • Node
      • Java
      • PHP
      • Rust
      • .NET
      • Mobile

      • React Native
      • Flutter
      • Android
      • Advanced Technologies

      • Cloud
      • DevOps
      • IoT
      • Big Data
      • Data Science
      • AI/ML
    Explore All Services
  • Industries
    • BFSI
    • Oil & Gas
    • Healthcare
    • Industry 4.0
    • Real Estate & Construction
    • Logistics
    • Fintech
  • Hire Talent
      Frontend
      • Angular Developer
      • React Developer
      • Vue Developer
      • Javascript Developer
      • UI/UX Developer
      • HTML/CSS Developer
      • Tailwind CSS Developer
      • Hire Frontend Developer
      Backend
      • Laravel Developer
      • Python Developer
      • Golang Developer
      • Ruby on Rails Developer
      • Node Developer
      • .NET Developer
      • .NET Core Developer
      • Java Developer
      • Spring Boot Developer
      • R Developer
      • PHP Developer
      • Django Developer
      • Rust Developer
      • C# Developer
      • Hire Backend Developer
      Software
      • Software Developer
      • Software Tester
      • Full Stack Developer
      • Offshore Developer
      • Remote Developer
      • Hire Dedicated Developer
      Mobile App
      • React Native Developer
      • Flutter Developer
      • Ionic Developer
      • Kotlin Developer
      • iOS Developer
      • Android Developer
      • Mobile App Developer
      Automation
      • RPA Developer
      • UiPath Developer
      Platforms
      • Salesforce Developer
      • MS Dynamics 365 Developer
      • ServiceNow Developer
      Artificial Intelligence
      • AI Developer
      • ChatGPT Developer
      • Alexa Skill Developer
      • OpenAI Developer
      • Pytorch Developer
      • Prompt Engineer
      • AIOps Engineers
      Machine Learning
      • ML Developer
      • Neural Network Developer
      DevOps
      • DevOps Developer
      • DevsecOps Developer
      Data Science
      • Tableau Consultant
      • Data Analyst
      • Data Scientist
      • PowerBI Consultant
      • Data Engineer
      • Qlik Developer
      • Automation Anywhere Developer
      Cloud
      • Cloud Developer
      • AWS Developer
      • Azure Developer
      • Google Cloud Developer
      Web
      • Web Developer
      • Web Designer
      • Webflow Developer
  • Portfolio
  • Contact Us
  • book a 30 min call
Angular + Redux + RxJs = NGRX

How to build an Angular application using NgRx (Angular 8 + Redux)- Part 2

Aishwary Rawat
Aishwary Rawat Director of Engineering
Last Updated on March 10, 2025 | Written By: Aishwary Rawat

In first part of the NgRx tutorial, we have covered the core concepts and detailed descriptions about what is NgRx; it’s a workflow and its need.

In the second installment, we will learn how to use actions, reducers, selectors, and effects in our application. So you will get an idea of how actually they are interrelated to each other.

So let’s get started.

In the following example, I will display the list(get) of users and add(post) a user using NgRx concepts. Also, I am going to change the state of the loader flag when HTTP request is called.

Before getting into the code, let’s see what we will be making.

Here is the Demo

GitHub Repository

ANGULAR CLI VERSION : “@angular/cli”: “~8.3.20”

Note: Add the Redux dev tools extension in your browser to check the store and state changes.

Install @angular/cli using the following command

npm i -g @angular/cli

Let’s create a new angular application.

ng new Ngrx-demo

ngrx
ngrx

After successfully creating the application, we will be adding the dependencies for @ngrx in our app.

npm install @ngrx/{store,effects,store-devtools}

And to make our application look better, we will be using ng-bootstrap and bootstrap package. It is not necessary, as you can add your own CSS framework or custom CSS.

npm install --save @ng-bootstrap/ng-bootstrap

Also, add the bootstrap package.

npm i bootstrap 

After successfully adding it, update your angular.json styles array.

 "styles": [
             "src/styles.scss",
             "node_modules/bootstrap/dist/css/bootstrap.min.css"
           ],

Now, let’s add these modules in our root module. i.e App Module

Are you looking to develop an Angular application using NgRx? Hire Angular Developer from us to build a reliable and robust Angular application with Angular 8 + Redux.

app.module.ts

StoreModule contains the state variable that holds our current state value. Here, users are our state variables. Generally, state variables are defined in selector.ts

EffectsModule loads the effects file when any action is dispatched.

NOTE: Here, I am using the below structure. It may vary according to your project structure.

EffectsModule

NOTE: I will be adding code in respective files. Kindly replace it with yours.

Now, let’s create a store folder to manage our NgRx flow in one place.

NgRx flow

actions.ts

In an action file, we take the enum type variable and assigns our actions to it. We need to create a class for each action that implements the Action interface.

In GetUserLoad = “[User] Get User,” there is no compulsion to write the string part(i.e. “[User] Get User”) But it is good practice to mention as it will help you to see which action leads to state changes in redux devtool extension.

It is a must to export the actions that I have done in the last line.

reducer.ts

In reducer, a type of action is being checked, and then our state gets updated.

effects.ts

Here, which effect gets called will be decided based on the action that is matched in ofType.

As in getUsers$, GetUserLoad action is dispatched from the get-user component.

We can also dispatch other actions here. Like, after a successful API call, it dispatches GetUserSuccess action and passing ‘user’ payload to it. Likewise, on failure, GetUserFail action gets dispatched with an error.

selector.ts

Selector helps in fetching and manipulating the data present in our current state. So here I am creating two const, first for getting all users and another for getting the first ten users.

index.ts

After completing the store folder, we will now add components, service, and interface. Let’s go!

ng g c get-user
ng g c post-user 

After successfully creating components, let’s add some code to it.

get-user.component.html

get.user.component.ts

post-user.component.html

post-user.component.ts

Now I am going to add a service file. Use the following command.

ng g service _services/users

This will create a users.service.ts file in a folder named _services.

 users.service.ts

Note: I am using fake rest APIs from https://jsonplaceholder.typicode.com/.

You can delete the users.spec.ts file as we are not going to write any test cases here.

users.service.ts

Now let’s add the interface file. Use the command below.

ng g interface _interfaces/users

This will create a users.ts file in a folder named _interfaces.

interfaces

user.ts

Now finally calling get-user and post-user components in app.component.html using their selector.

app.component.html

In app.component.html, delete all the starter code and add this code.

Finally, our coding part is done. Let’s run the application using the serve command.

ng s --port 4300

After compiling successfully, you will see this.

ngrx demo

That’s all!

I hope you enjoyed reading the blog post. Please, let me know your thoughts in the comment section below

Thank you and Happy Coding?


Expand Your Digital Horizons With Us.

Start a new project or take an existing one to the next level. Get in touch to start small, scale-up, and go Agile.


Or
E-mail us : solutions@bacancy.com

Your Success Is Guaranteed !

Related Articles

Dipal Bhavsar

May 29, 2025

AngularJS

Angular 20: Your Guide to the Latest Features and Improvements

By : Dipal Bhavsar

Angular 20 just launched, and it’s packed with exciting updates that make your app development faster, easier, and more modern....

Read More
Dipal Bhavsar

January 23, 2025

AngularJS

Angular Standalone Components: A Key for Faster and Modern Development

By : Dipal Bhavsar

This comprehensive blog covers everything you need to know about Angular standalone components. Introduced in Angular v14, standalone components allow...

Read More
Dipal Bhavsar

December 26, 2024

AngularJS

Angular Mobile App: Features, Benefits, and Development Guide

By : Dipal Bhavsar

Angular stands out as a versatile framework due to its feature-rich architecture and scalable capabilities. Angular mobile app deliver a...

Read More

Offices and Development Centers

Bacancy Ahmedabad Ahmedabad

15-16, Times Corporate Park, Thaltej, Ahmedabad, 380059

Bacancy Gandhinagar Gandhinagar

422-A, 4th Floor, Pragya Tower Road 11, Block 15, Zone 1, SEZ-PA Gandhinagar, 382355

Bacancy Hyderabad Hyderabad

Awfis, Level 1, N Heights, Plot No 38, Phase 2, Hitech City Hyderabad, 500081

Bacancy Mumbai Mumbai

18th Floor, Cyberone, opp. CIDCO Exhibition Centre, Sector 30, Vashi, Navi Mumbai, 400703

Bacancy Pune Pune

2nd FloorMarisoft-1, Marigold IT Park, Pune - 411014

Bacancy Bengaluru Bengaluru

Raheja Towers, 26/27, Mahatma Gandhi Rd, East Wing, Craig Park Layout, Ashok Nagar, Bengaluru, 560001

Global Presence

Bacancy New Jersey New Jersey

33 South Wood Ave, Suite 600, Iselin NJ 08830

Bacancy California California

535 Mission St 14th floor, San Francisco, CA 94105

Bacancy Massachusetts Massachusetts

501 Boylston St, Boston, MA 02116

Bacancy Florida Florida

4995 NW, 72nd Avenue, Suite 307, Miami, FL, 33166

Bacancy London London

90 York Wy, London N1 9AG, United Kingdom

Bacancy Ontario Ontario

71 Dawes Road, Brampton, On L6X 5N9, Toronto

Bacancy Australia Australia

351A Hampstead Rd, Northfield SA 5085

Bacancy UAE UAE

One Central 8th and 9th Floor - Trade Centre - Trade Centre 2 - Dubai - United Arab Emirates

Bacancy Sweden Sweden

Junkergatan 4, 126 53 Hagersten

Get in Touch

Great Place to Work

Get in Touch

cal-icon

Looking for expert advice?

Schedule a Expert Call

gmail-icon

Email Us

solutions@bacancy.com


  • Brochure
  • Quality Assurance
  • Resources
  • Tutorials
  • Customer Reviews
  • Privacy Policy
  • FAQs
  • QandA
  • Contact Us
  • Sitemap
  • Employee

bacancy google review 4.6
bacancy google review
bacancy clutch review 4.8
bacancy clutch review
bacancy goodfirms review 4.8
bacancy goodfirms review
iso
  • Bacancy Behance
  • Bacancy Pinterest

Copyright © 2025 Bacancy. All Rights Reserved. An ISO 27001:2013. Certified Company