Questions tagged [subscribe]
994 questions
3
votes
1 answer
The provided web push applicationServerKey is not valid
I am trying to subscribe to web push via the function below.
function postSubscriptionBo() {
return navigator.serviceWorker.register('/service-worker.js')
.then(function(registration) {
const subscribeOptions = {
userVisibleOnly:…

antrunner
- 87
- 1
- 6
3
votes
1 answer
Server Pagination: Typescript Save GET method data to number
I need to implement a server pagination for a table where the data is taken from an SQL Database and i need to save the data from the response as a number(count:number) but if i check the totalItems in consolelog the value is undefined.
If i change…

Eduard
- 83
- 6
3
votes
2 answers
When ngif from scrollDispatcher, the variable not working
In angular, I use scrollDispatcher(checking scrolling) change variable flag at html DOM, but the DOM(ngif) not work, there is my testing code:
// html
scrolling!
// TS
import { ScrollDispatcher } from…
Pork Jackson
- 339
- 1
- 15
3
votes
1 answer
Jasmine test property observable subscribe
I have this code:
export class ProgramComponent implements OnInit {
@Input() events: Observable;
eventsSubscription: any;
...
ngOnInit() {
this.eventsSubscription = this.events.subscribe((event) => {
... <- Some code…

ismaestro
- 7,561
- 8
- 37
- 50
3
votes
3 answers
Angular: Should I subscribe() to http.get() each time I need to update?
I wonder if I am using Observable.subscribe() too many times or not.
In my component class, I have a function loadData().
It calls another function this.service.getData() that uses HttpClient.get() to perform a HTTP request to the server.
Currently…

Kris
- 401
- 2
- 7
- 16
3
votes
2 answers
canActivate not working when url is typed
Basically everything works correctly until for some reason when the url is typed the variable this.estado within the method canActivate happens to be undefined.
I think that this because the constructor does not get the observable at the correct…

Kelevra
- 35
- 5
3
votes
1 answer
Angular subscribe response
Okay, I'm pretty new to Angular, so I have this little problem. So i'm following the Angular guide (https://angular.io/guide/http). So my problem is that my http-response is always undefined. In debug-tools the response is:…

user7190476
- 35
- 1
- 1
- 7
3
votes
3 answers
How to access value outside the .subscribe in angular 2 polling service
// I was trying to get the values from outside the subscribe but it cannot assign to any variable. In my project, get the json content using http.post() method and assigned it to a variable. I want to access these variable value outside the…

Nuwan Bandara
- 35
- 1
- 1
- 6
3
votes
1 answer
Randomly subscribes to stream when using mergeMap and forkJoin
The subscribe is running randomly when userId changes. Sometimes it does, sometimes i doesn't. userId variable is coming from a dropdown selector (Choices library).
Shouldn't subscribe always run even though userId is the only stream that…

Olafur Kari
- 103
- 4
3
votes
3 answers
Angular Http Subscribe not working
Hi In my Angular Component, i have this code in one of my methods
this.http.get("http://localhost:8080/poeples")
.map(
resp => { resp = resp.json(); }
).subscribe(
(data) => { this.poeples = data; },
err => console.log(err)
);
In…

shmoolki
- 1,551
- 8
- 34
- 57
3
votes
3 answers
Angular5 what's happened with valuechanges() function ? (angularfire2)
I try to understand .valueChanges() and .subscribe()
I use AngularFire2 and Angular5
My code works but I don't understand how it works.
My Component :
ngOnInit() {
this.itemService.getLastUnicorns().subscribe(items => {
this.items =…

Sylvain
- 238
- 2
- 15
3
votes
3 answers
Writing cleaner Promise completion closure
New to Angular and promises, but I've realized I've done this a lot:
this.myService.createFoo(data).subscribe(
(result: any) => {
resolve({success: true, data: result});
},
err => {
resolve({success: false, message: err});
…

7ball
- 2,183
- 4
- 26
- 61
3
votes
2 answers
Greenrobot Android Eventbus - No option eventbusindex passed to annotation processor
I'm trying to set up a simple subscriber in my Android application using Greenrobot's Eventbus, but I am getting a gradle build error. I have shown my code below.
Event class
public final class OffersProcessedEvent {}
Base Fragment
public class…

Dan
- 358
- 2
- 3
- 17
3
votes
1 answer
Receive Push Notifications on Firebase database child added
in my IOS application i have set up Firebase.
I'am able to read, write and delete data.
I also have setup Push Notifications and receive them from Firebase console.
What i did not get to work is to receive Push Notification when i add new data to…

Peter Sypek
- 151
- 2
- 12
3
votes
2 answers
Get data from json file in Angular 2
I have a json file and I'm trying to put this information in my project with a service in Angular 2. Here is my code:
That is my service:
import { Injectable } from '@angular/core';
import { Http, Response} from '@angular/http';
import…

vesselin ivanov
- 63
- 1
- 13