Questions tagged [angular-2+]

Use this tag on posts involving code written with versions 2 & above of Angular, the web framework from Google. Use the 'angular.js' tag for posts involving the older AngularJS (1.x) framework.

Filter by
Sorted by
Tagged with
3
votes
2answers
40 views

Are there technical issues/disavdantages on this BaseService that aims to simplify calling API endpoints

I have created an angular BaseService that aims to simplify calling API endpoints I would like to know if you see any code smells, bad patterns or architecture issues. What disadvantages could this ...
0
votes
0answers
11 views

Handling the first value for a variable, with Redux and the Backend service. Angular, Redux

I'm feeling this code is messy and also repeats between all components that needs to handle backend data. Any comment is appreciated. ...
0
votes
1answer
37 views

Unit Test case for services method in angular

I want to write the test case for Service class. My Service Class dynamic-form.service.ts ...
2
votes
1answer
38 views

Rxjs search in Angular

I created an rxjs search for a hiring company, but I got rejected for the following reason: -performance issue on a bigger data set. -bugs My question is how can I make this code better for the next ...
0
votes
1answer
40 views

RxJs - Flat nested swithMaps and pass variables on Http interceptor

How can the following method be flattened? I tried to pipe all the operators to the first pipe (from(this.fireAuth.currentUser)) but I lost access to the previous ...
0
votes
2answers
47 views

Verify application configuration from JSON file with matching type using TypeScript in an Angular project

To bootstrap our application we have a configuration stored in a JSON file. This config holds different settings, like definition of endpoints (e. g. an API or SMS gateway etc.) or some default values ...
0
votes
0answers
27 views

JS, a multi purpose function

this is an Angular application, this page will have a list and sublist with action for each one (add/edit/delete) the buttons (add/edit) will show a popup with the same form except the landmark will ...
0
votes
0answers
27 views

Is there a better way for this ui component?

I need to create a component for displaying a list of avatar users....If the users present in the array is more then 3 I have to display a number to indicate the remaining amount of users. Example: <...
0
votes
0answers
8 views

Simplifiy the following flow for upload file status tracking

I am using angular and rxjs, and I am doing the following : I would like to upload an image to GCP, so I need to generate a signed url, upload the image,and while showing status of all the request. ...
0
votes
1answer
29 views

Handling a spinner for multiple REST calls

Context In an Angular application, I have three <select> boxes that are fed from the database with a relatively small data set. These boxes are part of a ...
2
votes
0answers
86 views
1
vote
1answer
33 views

Is it possible to make a re-usable icon component that doesn't create duplicate TemplateRefs

I have attempted to create an IconComponent that shows a different SVG icon depending on the string that is passed in. Example: ...
0
votes
1answer
43 views

Refactor dynamic filter functions

I create this menu filter component: with this menu, in practice, you can filter on a cards list feeling free to choose different filters at the same time; the cards list returned will be the results ...
0
votes
0answers
33 views

Display nested list within Angular app

I'm looking to optimise this code. Items ...
0
votes
1answer
25 views

Angular observables piping

I wanted to check and see if this was as efficient as can be. The goal is to get a user's data from a group of documents that contains references to users in Firestore. ngOnInit ...
0
votes
0answers
95 views

Best practice for multiple conditional HTML options with similar code blocks

So I'm pretty new to HTML/Angular and frontend tech in general. I'll include my code below, but as you'll see there's a LOT of commonality between the switch cases, what I'd like to try do is have ...
0
votes
0answers
35 views

Implementing Django's “reverse” functionality in Angular-Routing

I've started learning Angular (With Angular 10) roughly 2 months ago and I recently began wanting to avoid hard-coding my URLs under any circumstances, but was unable to find anything that satisfied ...
0
votes
0answers
200 views

Angular Typescript Async queue service

i've implemented a waiter service in Angular for syncronice multiple calls to one async function and i want to know if there exists a simplier way of atchiving the same result or if it's over ...
3
votes
2answers
793 views

Angular10 RxJS - Interceptor to add/refresh JWT Token

I have a project, for which I use Tokenauthentication with JWT Tokens. I am relatively new to Angular Development and rxjs in particular, so there are a lot of concepts I am likely not yet familiar ...
2
votes
1answer
49 views

How to approach separation of layers mapping response to model in Angular app?

I want to organize mapping for my Angular app so that code structure would clear for other developers and I want to have as less code as possible. I have an api service that is responsible for ...
2
votes
1answer
137 views

Rewrite BehaviorSuject that takes either localStorage or Observable in Angular

I have this code ...
4
votes
2answers
148 views

Angular Frontend login logic

This is a follow-up to this question Node.js backend login logic. I wrote the following login Angular frontend logic for my Node.js Backend (see the previous question above). Is it any good in terms ...
2
votes
0answers
55 views

The best way to handle many, different requests with custom query params

I have a list of products, I would like to filter that products e.g. by number, price, type etc. using checkboxes, selects and inputs. I get my data from REST API - using query params in GET method. ...
2
votes
0answers
58 views

Storing localStorage data as part of rxjs reducer?

I use ngrx in my Angular app to state management. At a certain time I was asked to save some variable to local storage and retrieve it with first load. That made ...
4
votes
0answers
28 views

Is my Angular Material MessageBox component well build?

My angular knowledge is limited, so I don't know much yet about it's garbage collection etc to make sure my component can be used without any strange side effects or memory leaks. I've created a ...
3
votes
0answers
22 views

Simple Effects in Angular 2+ application using Firebase, NGRX and RXJS

Made an Angular app using Firebase, RXJS and NGRX. ...
2
votes
0answers
28 views

Ngrx effects in angular application

...
3
votes
0answers
27 views

Alternative Way of comparing multiple variable's to multiple variables

Hi guys Im very very new To Angular/Typescript Im teaching my self section by section by just messing around and figuring things out. Currently im just doing loop's and outputs so I decided to write a ...
3
votes
1answer
47 views

Iterating an Array Object & Assigning the Attributes Values to those that Match the Condition

Is there any approaches to reduce the below coding snippet in Angular 2+ with few lines of code by making use of ECMA Script or by some other ways ...
2
votes
0answers
35 views

Switching article states using state pattern

The Article model supports a bunch of transitions. Only two are shown below: star()/unstar()....
3
votes
0answers
316 views

RxJS - Prevent valueChange of one form control if another form group is dirty OR an HTTP error has occurred

I've recently started working on an Angular 7 project (I'm pretty new to Angular and RxJS), and I was requested to implement this new functionality: The Problem I have to implement a component to ...
5
votes
1answer
48 views

Code Refactoring for Dynamic List in Angular 8

With a specific requirement of showing/hiding the pages, the following implementation has been carried out. The pages which needs to be hidden will be provided through an array ...
2
votes
1answer
24 views

Javascript: Mapping combinations of input and possible suffix arrays leads to repetitive if statements

I am writing a program to combine the basic form of a word with suffix arrays following the choices from a form group (Angular 9) to receive the declination. This is the flow: The user inputs a word....
2
votes
0answers
36 views

NativeScript - Angular Service to watch iOS keyboard event listeners

I'm writing an app with NativeScript 6.4.1 and Angular version 8. There are a series of UI events in iOS that you can watch to see what the keyboard is doing: https://developer.apple.com/...
1
vote
0answers
25 views

Angular8 & RxJs: handling Observable in interceptor

the following tutorial uses an interceptor to show/hide a loading bar: https://www.freakyjolly.com/http-global-loader-progress-bar-using-angular-interceptors/ ...
1
vote
0answers
32 views

Autofilling multiple selectors Angular

Multiple forms make use of the autocomplete of material, which gives a resulting code that is repetitive and difficult to maintain. The controller is left with pairs of repeated methods [for each ...
2
votes
0answers
18 views

Actions component in Angular

I have an action bar component. It helps do the CRUD operation for different component. Its only job is emit events. The emitted events are listened by the caller component. I am using a switch case ...
2
votes
0answers
43 views

Group data based on dates to populate a Material Angular table with rowspans

I have this method that attaches the year and year's rowspan for a TD and Quarter and a Quarter's rowspan for the TD. Year and Quarter are 2 columns in an Angular Material Table which are calculated ...
2
votes
1answer
198 views

Subscribing and manipulating data from API in Angular

I'm trying to display the fetched data on a table. I structured the data based on the columns table in the UI and stored them in an array, then *ngFor on the table ...
1
vote
0answers
24 views

Angular ReactiveForm Error Association

I want to associate an error message to a Validator and not have to in the html check for a specific error. aka *ngIf="controls.name.required". I've seen generic error message helpers that build up ...
4
votes
0answers
334 views

IndexDB (RxJs) - Angular Service

Inspired by Wrapping IndexDB with RxJs. (Edit - Added a Stackblitz example). My use case is a simple, on-disk temporary cache. No errors are propagated, null ...
3
votes
1answer
431 views

@angular/fire Firestore cached service

I've written a service for firebase that handles all my Firestore calls. The goal is to only read the database once on app init( load() function) and then keep a copy of the database inside local ...
3
votes
0answers
66 views

Correct and safe way of performing token exchange?

I am dipping my fingers in external apis that a user would login and retrieve a code to exchange for a token. In my case, it is for the SpotifyAPI. All the web app does it return the users top ...
1
vote
0answers
32 views

Custom validator for reactive forms angular

I have created like this validator for reactive form, all working but I think I used so many statements, can somebody help me to make proper validation Here is my validator ...
2
votes
1answer
152 views

Is returning promise form angular service bad?

What is the problem when I return a promise from angular service instead of Observable? If it's a matter of any manipulation or side-effect, that I can easily do ...
3
votes
0answers
94 views

A reusable card component

I tried to create a reusable component which would allow the user to create cards which can have a header, cover image, avatar section (image, title and sub title), a description, a table, a list and ...
1
vote
3answers
76 views

Simplified method with multiple if-else

I need to refactor some pice od method for drag-and-drop angular material. Here is a working method in production, I need suggestion for CLEAN way to write this method. I can't change var name and ...
2
votes
0answers
37 views

HTML game engine within angular

I currently have a very very basic js script that runs something 30 times per second. This is later to be used in a game engine. But now I'm not quite sure how I can best do that. This little script ...
1
vote
0answers
26 views

Adding conditional check to display information in Angular 8

I am displaying the following information in angular 8 application. I need to display only the partnerName if it exists. ...
3
votes
1answer
1k views

Dynamically create array with nested objects/array

I need help to dynamically create an array with nested objects holding again an array of objects each. The structure is as follows: ...