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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
5
votes
Sort an object array with two variable based on the language
Constructor
The constructor should mostly just be used for injection:
...
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 ...
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
...
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:
...
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:
<...
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 ...
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 ...
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'...
3
votes
Accepted
JSON API call in an Angular service
Create one httpservice and extend it in your service, for example:
HttpService:
...
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
...
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 ...
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 ...
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 ...
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:
...
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
<...
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 ...
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
...
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.
<...
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 ...
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:
...
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, ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
angular-2+ × 155typescript × 112
javascript × 44
rxjs × 35
html × 6
observer-pattern × 6
unit-testing × 5
firebase × 5
json × 4
validation × 4
form × 4
jasmine × 4
beginner × 3
array × 3
api × 3
event-handling × 3
html5 × 3
http × 3
browser-storage × 3
object-oriented × 2
comparative-review × 2
ecmascript-6 × 2
template × 2
generics × 2
angular.js × 2