subscription

Angular 5+ cannot save result form observable response

冷暖自知 提交于 2019-12-02 05:08:39
I have an Angular app which consumes data from a webapi. When i make a request then i get an typed observable. now when i do this: data: Product[]; productService.getByProductId("061000957").subscribe(res => { console.log(res); this.data = res; }); console.log(this.data); what i see in the console i can see this I can clearly see, that the result has the Product i need. But why cant i save this to my local variable data? Thanks Observable is asynchronous just like promise. So console.log(this.data); is executed before the response is returned . Try . data: Product[]; productService

“Resource not found for the segment” using Graph subscription beta

℡╲_俬逩灬. 提交于 2019-12-02 04:10:17
Im using the Microsoft Graph to get calendar event with application permission. It works perfectly. Now Im trying to set up a subscription to listen to event changes however the normal v1.0 do not suport this. However beta, at least in the description, say it works. From the page: https://graph.microsoft.io/en-us/docs/api-reference/beta/api/subscription_post_subscriptions "Note: the /beta endpoint allows Application permissions as a preview feature for most resources." So I tried this with the URL: https://graph.microsoft.com/beta/subscriptions Sending in a json object like this: { "changeType

It is possible to get the Azure Subscription offer, or offerId with PowerShell?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 03:17:51
Is it possible to get Azure Subscription Offer, or offerId, using Powershell? Through the portal this would be Subscription -> properties -> Offer or offer ID? I've been searching for a while, but I can't see it. Thanks, There is an unofficial possibility to get the offer id which is used by the Azure Portal itself. I tested it with my subscription and it worked. It may lead to issues for specific offer ids. Please provide feedback on that. These are the required steps: Acquire an Bearer authentication token https://docs.microsoft.com/en-us/rest/api/azure/#acquire-an-access-token Assemble a

Wait for subscription to complete

拥有回忆 提交于 2019-12-02 00:55:00
问题 I have a simple scenario: I want to store an array returned from a service into a class variable. How do I wait for the data to be available until I store the data? It is available if I wait a certain amount of time (tested with settimeout) . Service: public getEventHistory(): Observable<heatmapElement[]> { return this.tokenResolver.getToken(true).switchMap(token => { var headers = new Headers(); headers.append('Authorization', 'Bearer ' + token); headers.append('Content-Type', 'application

Wait for subscription to complete

半腔热情 提交于 2019-12-01 21:24:32
I have a simple scenario: I want to store an array returned from a service into a class variable. How do I wait for the data to be available until I store the data? It is available if I wait a certain amount of time (tested with settimeout) . Service: public getEventHistory(): Observable<heatmapElement[]> { return this.tokenResolver.getToken(true).switchMap(token => { var headers = new Headers(); headers.append('Authorization', 'Bearer ' + token); headers.append('Content-Type', 'application/json'); return this.http.get(this.restApi, new RequestOptions({headers: headers})); }) .map((res:

Logout to add a friend in xmpp smack

十年热恋 提交于 2019-12-01 13:44:04
In my application when I have to add a friend I usually do send subscription packets 4 times i.e A->B (subscribe) B->A ( subscribed) B-A( subscribe) A->B ( subscribed) After each step I see on the server the status changes immediately. But in my application it only comes to reflect after LOGGING OUT and LOGGING in again. THE PERSON HAS TO LOGOUT ONCE AFTER HE HAS ADDED A FRIEND AND THEN ONLY THE FRIEND IS SHOWN IN HIS FRIEND LIST> What's the problem? I have found a lot but didnot found any error :( No error is showing in the logcat. I have also printed the syso output after each packet is sent

Logout to add a friend in xmpp smack

耗尽温柔 提交于 2019-12-01 10:25:16
问题 In my application when I have to add a friend I usually do send subscription packets 4 times i.e A->B (subscribe) B->A ( subscribed) B-A( subscribe) A->B ( subscribed) After each step I see on the server the status changes immediately. But in my application it only comes to reflect after LOGGING OUT and LOGGING in again. THE PERSON HAS TO LOGOUT ONCE AFTER HE HAS ADDED A FRIEND AND THEN ONLY THE FRIEND IS SHOWN IN HIS FRIEND LIST> What's the problem? I have found a lot but didnot found any

Paypal Express Checkout Subscription using Credit Card Payment

佐手、 提交于 2019-12-01 08:00:37
Question: Is it possible to set up a subscription via Paypal api Express Checkout, so you can pay via Credit card and Paypal login. The Paypal login works no problem, but I can not get it to work with credit cards at the moment. I have set the NVP SOLUTIONTYPE = Sole I know you can set up a paypal subscription button, but the client want to sell a product (single payment or instalments) and add a subscription if user wants to sign up. Many thanks for any help. Llewellyn UPDATE: For anyone else who has this problem I got this response back from Paypal: With subscriptions and Express Checkout,

Paypal Express Checkout Subscription using Credit Card Payment

半世苍凉 提交于 2019-12-01 07:22:55
问题 Question: Is it possible to set up a subscription via Paypal api Express Checkout, so you can pay via Credit card and Paypal login. The Paypal login works no problem, but I can not get it to work with credit cards at the moment. I have set the NVP SOLUTIONTYPE = Sole I know you can set up a paypal subscription button, but the client want to sell a product (single payment or instalments) and add a subscription if user wants to sign up. Many thanks for any help. Llewellyn UPDATE: For anyone

Catching exceptions which may be thrown from a Subscription OnNext Action

别等时光非礼了梦想. 提交于 2019-12-01 03:58:13
I'm somewhat new to Rx.NET. Is it possible to catch an exception which may be thrown by any of the subscribers? Take the following... handler.FooStream.Subscribe( _ => throw new Exception("Bar"), _ => { }); Currently I'm catching on a per subscription basis with an instance of the following. The implementation of which just uses a ManualResetEvent to wake up a waiting thread. public interface IExceptionCatcher { Action<T> Exec<T>(Action<T> action); } and using it like so... handler.FooStream.Subscribe( _exceptionCatcher.Exec<Foo>(_ => throw new Exception("Bar")), //It's disappointing that this