The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
2
votes
0answers
37 views
+200

Angular control for inputting latitude and longitude with validation

I've built a custom control to handle user input in a human-readable format, but save in a machine-format. It needs to have input validation, and to convert UI-input to a base format. I'm interested ...
1
vote
1answer
39 views

Compare multiple values of an array in the same time in Javascript [closed]

As of now the below code working As expected. But in future if the newFilterArr have new record again I want to reedit this functionality. So how to overcome this? ...
1
vote
0answers
19 views

Angular8 pass all data through FormGroup

How to improve this code? Is it somehow possible to remove fields fro, html and pass all necessary data through FormGroup? app....
1
vote
0answers
10 views

Angular 6+ Conditionally Chained HTTP Calls

I have a number of async calls that get chained conditionally based on the previous data dependency. I.e. perform call A -> if the result is defined/not an error execute a side effect, if not perform ...
1
vote
0answers
9 views

Setting the token for API client generated instances in an Angular application

The context I am developing an Angular application who also consumes an external REST API. I am also trying the OpenAPI generator using a TypeScript template. The OK path is the following: call a ...
1
vote
0answers
27 views

Media library project using Angular

Recently I created a small project: 'media library' (which allow to search, sort and filter items) and I will be glad if some give me constructive feedback about my code. The starting point is Angular-...
1
vote
0answers
18 views

Angular forms - reactive vs. [(ngModel)]

I am developing this angular app and it has big forms with 100 + fields. I was thinking about using [(ngModel)] without reactive forms, so that it's easier to do ...
3
votes
0answers
16 views

Reference enum values in Angular template without aliasing the enum type

Is there a way to improve this code? I'd like to use the enum type PaymentMethoddirectly in the angular template without renaming it to ...
2
votes
1answer
37 views

Angular Rest API generic service and implementation service

I'm wondering if there's a better way to write the ApiService and the CategoryService so that CategoryService is basically just a call to extend ApiService with the string 'category' and the base type ...
1
vote
0answers
9 views

Better way to apply class based on multiple conditions

I am using Angular 8.x. I have a table with two columns that can be sorted. You can only sort one column at a time. I have conditions that display an up and down sort icon if neither column is being ...
1
vote
0answers
18 views

Sass mixins vs Angular layout components [closed]

For a long time I've been using Angular "Layout" components so their role is basically to define layout, like padding, margin, fonts and so on. For instance, page header component: ...
1
vote
0answers
21 views

Subscribe once and reuse the Angular Subscription each second

I am creating a web application using Angular 8. This application is all about talking to the stock markets server and getting the Live updates every second. I have one query here. Below is my code: <...
2
votes
0answers
13 views

Managing Angular subscriptions

There are different methods to get data from server in Angular application: Get Observable from the service and subscribe to it at component Create Subject at the service and subscribe to the Subject ...
2
votes
0answers
17 views

Submiting form and transform model to match backend

I have different model in frontend and backend. When I submit form in frontend I need to transform that object to match backend model. Is there a better way than this one: ...
2
votes
0answers
20 views

RxJs observables pipes SwitchMap and async with typealong search input

I'm using RxJs for type along search, I setup an observable to emit a value after 1 second so it behaves like http with delay. I subscribe to it via the async operator in the template, the component ...
0
votes
1answer
39 views

Is there an elegant way to re write my angular code?

Hi Currently i have an angular 5 project . i have a method named createForm. it will basically create just a form. however the form created changes depends on the flight inventory code . if flight ...
2
votes
0answers
21 views

Recuperate user's details into fake JSON server

This is the 'details.ts' which define the user's details that I want to recuperate in a JSON (user's role, logintime, duration). ...
1
vote
0answers
24 views

Processing the results of API calls and process data

I'm making use of RxJS and observables within my Angular application to process the results of API calls and process data. I've written the component and it works without any issues. However after ...
1
vote
1answer
48 views

Creating a real unit test in Karma for Angular code [closed]

This is a piece of test code made for the Angular application. The router object is a mock provided by the RouterTestingModule dependency. I wonder if such a test can be considered a unit test (...
2
votes
0answers
142 views

Angular 8: Scroll spy implementation for a timeline Contents

I have made a timeline component that can have multiple milestone/major/minor as sub components nested within timeline container component. I have also added a side navigation for that lists all ...
0
votes
0answers
22 views

Complexity of a service method to fetch search results from an API

I tried the plug in CodeMetrics for Visual Studio Code along with some of my current Angular projects, and I was a little suprised about the outcome. I have a ...
1
vote
1answer
79 views

FormArray total of each formgroup via RxJS

Stackblitz - https://stackblitz.com/edit/angular-plp4rb-formarray-total-prs9ay I'm new to RxJS observables. I've created a form array where the total for a line is ...
5
votes
1answer
37 views

Merging client names into orders using RxJS

I have an API which I can't modify. I have to use data as it is. I want to join data from two separate requests where the second request is based on data from the first one. I have a working ...
3
votes
1answer
63 views

Separating items into ordered and unordered lists

I'm trying to group all the types which have ordered-list-item & unordered-list-item into new object. How can I simplify the function and reduce multiple return statements? ...
2
votes
0answers
397 views

Accordion component with Angular 7

I have to made an accordion-, respectively "zippy"-component using Angular 7. I'm new to Angular. Just started with it a few weeks ago. But with some Google-usage I was able to implement the ...
2
votes
0answers
345 views

Mapping nested arrays from API response

I have some selects on my html page that I want to populate with the response from my backend API. The response looks like this JSON response ...
1
vote
0answers
22 views

angular service for centralizing common grid functions

I have an angular 7 app that is data focused and as a result has dozens of grids. These grids are from the Kendo UI for ANgular component library made by Telerik. These grid components expose hooks ...
1
vote
1answer
51 views

Unit Test case to check if localstorage is empty once I logout of the Web app

I am trying to clear my localstorage when I am logging out of the application. I want to write a unit test case in Jasmine to check if this task is performed when logout function is run. I am writing ...
2
votes
0answers
97 views

Angular polling and plotting component using Firebase

I could use some help refactoring my component and service. I have a lot of nested logic and wasn't sure what I could do to improve this. I'm new to Angular 7 and their piping syntax. I suspect this ...
2
votes
0answers
22 views

Two Angular animations for modal dialogs

I'm using Ionic 4 and Angular animations to animate modals. I created the following two functions that control the animations but they share a lot of repeated code. Is there a way I can clean these up ...
1
vote
0answers
71 views

Angular 7 HttpClient POST and GET

I have googled and read many tutorials about fetching data and posting data to Rest API. But i have never seen a tutorial with how to handle the getting of new data after a POST or an PUT in a best ...
0
votes
1answer
66 views

Angular pipe to suppress sensitive information

I have created an Angular pipe to suppress the sensitive information like credit cards, bank account, ABA numbers etc. This is working fine but I would like to know if this is the best possible way ...
0
votes
0answers
20 views

Angular service that configures translations based on current business case

I have a simple Angular Service that pre-configures translations for the ngx-translate library based on the currently logged in business case. I'm not sure if my switch case statement within the if/...
1
vote
0answers
24 views

Optimistic validation on tab change

I have a rather large UI for editing a user within a Angular application. It is split in multiple tabs and in order to reduce complexity the user cannot change the tab unless there is no validation ...
1
vote
0answers
75 views

Angular Websocket service with wait for response sending

I am writing an Angular Websocket service that can send messages to a server and then can subscribe to the response. I am grateful for every suggestion to improve this. ...
0
votes
0answers
39 views

Angular HTTP POST with Basic Auth and Form Data

I have an API that I need to use that requires 2 things Basic auth with user: username & password: api token The request ...
1
vote
0answers
57 views

Angular component for select with custom input

I'm creating an Angular widget which combines a dropdown with a custom input. I've made it generic and am preparing a blogpost explaining my setup, and would love to get a review before I do so. The ...
1
vote
1answer
258 views

Angular component to render currency or date values

I have an Angular component and it is just a label which renders a value and if it has an associated pipe, the output of the pipe should be rendered as value of the label. But I don't want to declare ...
2
votes
0answers
35 views

Caching different http-requests

There have been multiple discussions on caching http-requests with RXJS. In this question/proposal I want to propose a custom rxjs-operator (non-pure) to provide ...
0
votes
0answers
29 views

Parse json data for forms

I have this form who get all the data from json, and serialized it to make it fill in the UI of material. I was thinking about making a class and name it parses who parse all the data for the ...
1
vote
1answer
507 views

Unit testing static method that imports environment file

I'm (very) new to writing unit tests and I'm wondering how I should approach testing a static method that constructs our API endpoints based on what the properties are set to in our ...
3
votes
0answers
105 views

Fetching user information along with user posts in Angular

Here is my code with 2 services, one is messageService which is used to get user messages: ...
0
votes
1answer
162 views

Arhitecture of Angular 7 online shop

I created online shop with angular 7 and I am not sure is good architecture. I created 5 modules: main module products shop-cart core admin I have service : ...
2
votes
1answer
87 views

List component using RXJS Angular

I have a small angular project, where I have an Article component to list articles with pagination system. The default page The placeholder loader page The main objectives are: Display the ...
1
vote
0answers
89 views

@bound decorator for TypeScript

I'm working on an angular codebase that very frequently uses constructs like: <c-whatever [action]='doSomething.bind(this)'> to pass reference to the ...
1
vote
0answers
14 views

Organization project and http-Client

I did not have experience with organization project and http-client. I suppose this is the right way. I have data-storage service where I store my data from server. ...
2
votes
2answers
105 views

DataService that fetches data not loaded already or loads cached values

I load an array from an API that is available throughout the user's whole session. This data is unlikely to change, so it can be cached safely. I have a DataService ...
1
vote
0answers
20 views

Angular2 “Logged In State Watcher”

I have a small website I'm working on as a hobby and I created a login page/home page so far. I wanted to get the basic login/logout functionality going before filling out the main part of my site. ...
1
vote
1answer
961 views

An Angular service to provide window and document objects

In some components and services I need the window and document. So I created a small service, that provides these two objects. ...
1
vote
1answer
114 views

Language switcher, consulting browser's localStorage

I'm using angular 6 and ngx-translate. This is my switch language function ...