Questions tagged [angular-observable]

270 questions
4
votes
1 answer

Subscribing to observables in route guards and its implications

I have a router guard called PermissionGuard which is initiated here const routes: Routes = [ { path: ':company', component: CompanyComponent, canActivate: [PermissionGuard], canActivateChild: [PermissionGuard], children: [ …
Gjert
  • 1,069
  • 1
  • 18
  • 48
4
votes
1 answer

Angular2 Reactive Forms and BehaviorSubject

I am new to Angular and cannot figure out updating reactive forms with async calls. I have a reactive form based on an object model. Any change in the form triggers an HTTP request that might send back an updated version of the object as a…
4
votes
3 answers

Simplest syntax for exposing a property as an observable?

I've seen tutorials showing umpteen different ways to implement observables in Angular. Many of them seem overly complicated for my purposes. Others are for previous versions and no longer work. Let's say I have a service with a single property…
Derrick Miller
  • 1,860
  • 3
  • 21
  • 37
4
votes
2 answers

Type 'boolean' is not assignable to type 'ObservableInput<{}>'

I am working on angular 6 project. I am using canDeactivate for my routeGuards and a popup to show route leave message. But the issue is coming at my price-list-guard-service on hover .flatMap(isAllow)=> { Error: Argument of type '(isAllow: boolean)…
Er Vipin Sharma
  • 2,519
  • 8
  • 22
  • 32
4
votes
2 answers

Observables for Angular-forms

I have a form on my site.(person.firstName, lastName, DOB, Gender, Citizenship, etc...). My question is how I can observe whole form changes and get from this observation 2 things: formControl with it's current status current value for handled…
4
votes
2 answers

Angular 5 Get correct Observable type from http request (why is it always Observable?)
I'm having a little trouble getting the correct observable type from an http.get request. Here is the function I'm having trouble on: getMovie(title:string, year:number): Observable { const params = new HttpParams() .set('title',…
4
votes
1 answer

Angular - Combine params and queryParams observables

How can I combine these to observables into one? They have the same functionality. this.sub = this.route.params.subscribe((params: any) => { // functionality }); this.sub = this.route.queryParams.subscribe((params: any) => { // same…
Michalis
  • 6,686
  • 13
  • 52
  • 78
3
votes
1 answer

Why Angular component is just updating after click?

I am new to Angular so I wouldnt be surprised that I am missing basic things. I tried Angular docs and googling, but no clue so far of why my component just updates the UI after a click? My scenario is, I want to have a shared component called…
Tiago B
  • 1,937
  • 14
  • 34
3
votes
1 answer

Type 'Observable>' is not assignable to type 'Observable'. Type 'UI[] | Promise' is not assignable to type 'UI[]'

I need to return a list of UI and I do this method: getList(): Observable { return this.httpClient.get("/api/listui").pipe(map( (response:Response) => { return response.json(); }, ), catchError((error)…
poopp
  • 1,297
  • 2
  • 13
  • 23
3
votes
0 answers

How to create multiple behaviour subjects dynamically and subscribe to them?

I am new to angular and rxjs, I am working on an Angular project and my component has a Behaviour subject declared as follows: therapySessions: BehaviorSubject = new BehaviorSubject([]); therapySessions is filled with values on the component…
3
votes
2 answers

Async custom validator not working and showing error message in Angular 8

I am new to Angular 8 and trying to create custom async validator. Below is my code: In my typescript file I am creating form field like below. I am using only async validator(no sync validator so passing 'null' as second…
Code Explorer
  • 65
  • 2
  • 7
3
votes
2 answers

How to test the side effects of a subscription in an Angular component

I have an Angular component, MyComponent, which calls a method returning an Observable and subscribes to it, something like export class MyComponent { someProperty; constructor(service: MyService) {} someButtonClicked() { …
Picci
  • 16,775
  • 13
  • 70
  • 113
3
votes
1 answer

Observable.subscribe() not called after using Router.navigate()

I'm creating a little app which show books from a database. My project looks like this: | presentational | ---> book-card | ---> book-details | containers | ---> book-item | ---> books | services | ---> books I use BookItemComponent as a container,…
3
votes
1 answer

This import is black listed , import a sub-module instead

Query 1 Below is the import section of my app component with observable import that got the code working. import {Component, OnDestroy, OnInit} from '@angular/core'; import { Observable } from 'rxjs/Rx'; import…
H Bala
  • 1,271
  • 2
  • 14
  • 28
3
votes
1 answer

Angular 5 - Observable return error cannot read property of undefined

I'm starting to implement a simple pagination using Spring Rest and Angular 5 inside my angular service when I call my web service using httpClient a get a correct response with the requested page it's display data on my page correctly but there an…
e2rabi
  • 4,728
  • 9
  • 42
  • 69
1 2
3
17 18