Skip to main content
9 votes
Accepted

Angular 2 clock with RxJS Observable

Your service looks perfectly fine to me. As far as the Clock component goes, I can only recommend one thing. When ...
Igor Soloydenko's user avatar
6 votes
Accepted

Counting characters inside of a textarea using Angular

You don't need to declare an extra reference variable. I would suggest the first approach i.e. using [(ngModel)] for two-way data binding. However, in the first ...
FAISAL's user avatar
  • 176
6 votes

Angular directive to disable a button when clicked, allowing re-enabling as needed

One of the main ways in which you can improve this is by using Renderer2 in the directive instead of directly accessing this.el.nativeElement and making changes to ...
SiddAjmera's user avatar
5 votes

RxJS Observable with initial value

This is a really good question -- starred it! I am not very experienced with RxJs, but I believe your code around BehaviorSubject and ...
Igor Soloydenko's user avatar
5 votes
Accepted

Angular service for fetching and passing data with observables

One of the improvements would be to use an HttpClient instead of Http for making the API calls. If you use ...
SiddAjmera's user avatar
5 votes
Accepted

Code Refactoring for Dynamic List in Angular 8

To handle such dynamic cases, you need to have dynamic code in both ts and html side.Take a look at this demo code which can be ...
Shashank Vivek's user avatar
5 votes
Accepted

Angular Frontend login logic

Sorry I didn't took a look at your backend code, so this is just half a review. For your questions: Security As Sam already analyzed, there is no obvious problem on the frontend part (as long as you ...
JanRecker's user avatar
  • 554
5 votes
Accepted

Angular10 RxJS - Interceptor to add/refresh JWT Token

Short explanation of the code If the token is expired and not yet requested, the process is quite straight: Change tokenRefreshInProgress status to true so that ...
JanRecker's user avatar
  • 554
5 votes

Sort an object array with two variable based on the language

Constructor The constructor should mostly just be used for injection: ...
H3AR7B3A7's user avatar
  • 229
4 votes

Angular2 Route Interceptor

I found this post because I needed something that did what you implemented. I tried to use the code and ran into some nasty routing bugs whereby Angular was experiencing internal errors. The cause is ...
MgSam's user avatar
  • 141
4 votes
Accepted

Angular Rest API generic service and implementation service

I think you can use HTTP Interceptors to simplify the code. For the authorization ...
Alexei's user avatar
  • 1,816
4 votes
Accepted

RxJs - Flat nested swithMaps and pass variables on Http interceptor

Your specific example can be simplified by treating the non-observables as simple variables, eg: ...
James Y's user avatar
  • 56
3 votes
Accepted

Quiz component with different but similar data models

Not the Strategy yet I'd try to not have a super huge ExtraCard component class if possible. The idea is to encapsulate the data in a Card interface/classes: <...
Igor Soloydenko's user avatar
3 votes

Angular 4 Application

Only a couple of beautifying changes i would make. I hate giant app.modules so i like to reorginize all core imports into core.module and import that into app.module, like described here. under "core ...
IamSneaky's user avatar
3 votes

Modal component in Angular 2

Cool stuff, though instead of declaring _isOpen property as a <boolean> in the service class, you should provide a new interface (as you added ...
Daniel Mylian's user avatar
3 votes

Audio player in Angular 2

There is one way I can think of improving this. In angular2, components should only handle view logic. The problem isn't there at the moment but could be there when you add more functionalities. Let'...
IamSneaky's user avatar
3 votes
Accepted

JSON API call in an Angular service

Create one httpservice and extend it in your service, for example: HttpService: ...
Kostiantyn Okhotnyk's user avatar
3 votes

Lightweight Angular tooltip component

It just looks really good. I think it stayed this long unanswered because there's not much feedback to give. I reviewed and liked The commenting The naming The sizes of your functions Reading flow ...
konijn's user avatar
  • 33.2k
3 votes
Accepted

Angular + Redux app organization and initialization: transfer from a PHP-driven website

I'm especially interested in any feedback on my initialization procedures: ... Is that reasonable? As long as your code is dealing with configuration only, it looks good to me overall. (I assume, you ...
Igor Soloydenko's user avatar
3 votes
Accepted

API calls organization in Ionic (Angular) application

Your approach is already pretty good. What I would do to improve your code is the following: Use a config/constants.ts file for your constants. Generate two providers (using ...
J. Hesters's user avatar
3 votes

List component using RXJS Angular

The purpose of the request made in ngOnInit seemed unclear to me. I presume if any pagination info is not provided, then the result contains the default pagination ...
sardok's user avatar
  • 181
3 votes
Accepted

Unit testing static method that imports environment file

If you really want to unit test that logic, you should fake its data. In order to do that, you need a way to inject that dependency instead of getting it straight from it. You have 3 options: ...
A Bravo Dev's user avatar
3 votes

Angular component to render currency or date values

The syntax of both the pipes: Currency Pipe {{ value_expression | currency [ : currencyCode [ : display [ : digitsInfo [ : locale ] ] ] ] }} and Date Pipe <...
Sree.Bh's user avatar
  • 225
3 votes
Accepted

Managing Angular subscriptions

I suggest to use the first approach. You than can provide some pipes that could transform the returned values as you need. And if the articles are showed only in your component is better to store them ...
vnapastiuk's user avatar
3 votes

Angular control for inputting latitude and longitude with validation

A short review; Changing CSS for input seems too broad, just apply CSS changes to a class tied to your control ...
konijn's user avatar
  • 33.2k
3 votes

Dynamically create array with nested objects/array

I can propose more functional approach. I don't have arguments to say that it's better, it's just how I prefer to write code for generating two-dimensional arrays filled with some initial values. <...
Michał Terczyński's user avatar
3 votes
Accepted

Simplified method with multiple if-else

Yes, this could use a refactoring I think your instincts are correct. Those nested if-elses are hard to comprehend. And the simplest way to break it apart is by ...
Scott Sauyet's user avatar
3 votes

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

Hmm i would in a first refactoring change it to this: ...
JanRecker's user avatar
  • 554
3 votes
Accepted

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

I made some good experience with the following approach. Its more code, but it helped the other developers in the team (and especially the new ones) to get a good grip and a fast start. As always, ...
JanRecker's user avatar
  • 554

Only top scored, non community-wiki answers of a minimum length are eligible