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
1k views

RXJS queue up multiple http requests and send when x conditions happens

Just started to use rxjs few weeks ago, I think I'm getting most of it right, but my code seems to be not that efficient and prone to bugs I haven't run into yet! I need to be able to send http ...
0
votes
0answers
2k views

Angular 2 Autocomplete

I've tried to build a fairly simple, reusable and functional Angular2 autocomplete component. The component: ...
1
vote
0answers
58 views

Calling Service and Initiate under ngOnOnit (not in Constructor) Hook in Angular4

I am using WP REST API V2 with Angular v5. I am display all items available from API for /do route inside WeDoComponent ...
3
votes
1answer
295 views

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

Our system is largely a PHP-driven system. We're not doing the full split back/front-end. Most pages are plain HTML served directly by PHP. However, a few parts of the system are very dynamic and ...
2
votes
1answer
843 views

Angular - reusing an observable for different queries

This is just a dummy example, but in my real world application I get a lot of data from the web API and I'd like to manipulate it on the client's side. So, I kind of stored the observable I get from ...
1
vote
0answers
50 views

Pig game in Angular4

I am a newb in Angular 4. I have written a component but have some questions. I used member variables of class and modified variables within functions. Is this right approach or I should implement it ...
8
votes
1answer
382 views

Lightweight Angular tooltip component

I made a small Popup component to show different error/success...etc. messages. Template: ...
1
vote
1answer
37 views

Logging observable values while extending service

I'm trying to extend a service function which returns an Observable<T>. The idea is to extend the function so I can add logging functionality whenever the ...
1
vote
0answers
64 views

single component angular 4 / node.js app

I take part in the recruitment process and I have done a small task for it - a searchable map of bus stops in angular with node backend. I am new to angular and I need someone to do a serious code ...
2
votes
1answer
46 views

Angular2 Toggling showing and hiding between two elements

I have a tabs nav element that has two tabs, it needs to show a component based on what tab was clicked and hide the other component. If the clicked tab is already "active", the component needs to ...
0
votes
1answer
1k views

JSON API call in an Angular service

I have followed this format in my application to call the API and get data from it: ...
1
vote
1answer
222 views

Changing http-requests conditionally

I'm new to RXJS and I have a working piece of code for http-request and subscribing to Observables from a shared service in Angular. This works, but I'd want to get rid of the nested subscriptions, ...
3
votes
2answers
304 views

Quiz component with different but similar data models

I have a component with this template: ...
0
votes
2answers
1k views

Angular 4 Application

I have created an application with Angular 4. I set up the Angular application with Angular CLI. Can anybody check this and suggest some improvements? Following is the folder structure I used: In <...
0
votes
2answers
789 views

Angular2/4 broadcast service using RxJS

I am no expert in RxJS as I am still learning my way around the new paradigm of Observable/Subject. I was trying to implement a broadcast service (based on NgRadio) that allows a new subscriber to ...
3
votes
0answers
208 views

Vehicle price calculation Angular service

I have written a service which can generate prices from inputs. However, I feel that this can be "refactored" because it is not flexible enough. The code "works" however I feel if I could make this ...
7
votes
3answers
8k views

Counting characters inside of a textarea using Angular

I have a textarea and need to calculate how many characters have been typed into it. Both of the following solutions work correctly—which would be preferable,...
2
votes
1answer
4k views

Angular 2 window service that listens for 'click away'

This is the angular service I wrote window.service.ts. ...
3
votes
1answer
1k views

Angular 2 service to upload a batch job and poll for results

I have to write a web interface for one of my homebrew projects. Since I'm not familiar with HTML and CSS I've decided to take heavy duty framework such as Angular 2. This is my first experiment - I'm ...
2
votes
2answers
129 views

Filter ads according to the URL

I'm building an app in angular 4. Have a listing page which shows all ads. I want to reuse same HTML/ JS for this page for all my needs. My needs are: All ads should be shown in this page; Those ads ...
0
votes
1answer
447 views

Web developer profile page in Angular 2+

I recently took a class on Angular 2+ at Code School. I then rebuilt my homepage using Angular 4. I would greatly appreciate if any developer experienced with Angular 2+ can check out my code on ...
3
votes
1answer
3k views

Chaining 3 dependent HTTP request subscriptions one, which is polling

Here is a function that triggers after selecting from a dropdown to choose the floor. As you can see, there are 3 levels of API calls (regular HTTP GET requests with JSON responses) that chain ...
1
vote
1answer
882 views

Angular retrieve data through Pipe

I have recently come up with an idea to retrieve additional data through Pipe, and I am not sure if I created a cool solution or terrible abomination. I will try to present the problem and my solution....
2
votes
1answer
8k views

Jasmine unit test that triggers mouse events in Angular 4

I have the following jasmine test spec which triggers the mouse events in my directive. As you can see there is a lot of code duplication here, I am repeating the events here. ...
4
votes
1answer
210 views

Simple Cookie Service - Returns value of cookie based on cookie name passed in

Introduction So I have written a simple service that, when loaded, reads all of the cookies in the document, reduces them to a simple object where the cookie name is the key, and the cookie value is ...
3
votes
1answer
3k views

Best solution for returning results from a generic Typescript service

I am beginning to develop a common data service that can be used by other services. Specifically, this service will be injected into a generic abstract application service. I am trying to figure out ...
5
votes
1answer
8k views

RxJS Observable with initial value

Is it possible to get rid of the BehaviourSubject to have an Observable with an initial value? Another thing I don't like is that I'm using getValue() and then modify this value and push it with next ...
1
vote
1answer
3k views

Angular 2 / rxjs chaining HTTP calls

I have a registration form. Step 1 user creates an account. As user creates an account I need to authenticate user with the created account. in my account.service.ts I have following. Is this the ...
1
vote
1answer
1k views

Angular 2 Component conditionally displaying a list of elements from an array

This Angular component displays a list of polls that are fetched from the server and has a slide toggle giving the authenticated user the option to display all polls or just the ones that the user has ...
3
votes
2answers
569 views

Angular Guards - Firebase loggedInAndVerified

I have an app that I want to limit to both logged in and verified users. I was able to make two separate guards (logged-in.guard.ts and ...
2
votes
3answers
6k views

Angular2 Route Interceptor

WARNING: Please see @MgSam's answer for a fatal bug in my original code. He has a revised version that fixes the bug. I have made a route interceptor service that has an API to hook into every event ...
5
votes
1answer
4k views

Making multiple http request Angular2

I need to get some ids from contacts and contactgroups to be able to collect the data. My example works but i dont know if this is the way to go. ...
2
votes
1answer
5k views

Angular4 MultiSelect Component

I wrote an Angular 4 app and a part of it was a multiselect component. The multiselect component acts like a basic HTML select but gives you the ability to select more than one option, typeahead, and ...
5
votes
1answer
99 views

Angular component for a system to store student test scores

I am designing a system and in it there is a view where teachers can see a summary of test data on students. Here is the component of it: ...
10
votes
1answer
21k views

Angular 2 clock with RxJS Observable

I'm fairly new to Angular 2 and I started off with creating a clock for my app. I tried to stick to the official documentation tutorial. Folder structure: The CSS file is still empty and the HTML is ...
6
votes
1answer
12k views

Audio player in Angular 2

I just built an audio player in Angular 2 using a player component and a player service. It's all working fine, I just feel like there is a much better way to do this. Should the audio object be in ...
2
votes
1answer
859 views

Angular 2 sortable lists

I wrote a simple and small projects that present 3 buttons, each one loads a different list to the screen on the same place but not in the same time. In my HTML, I think I can maybe use some more ...