[AngularJS] Re: Store in Angular, with async processes : no Redux please

2019-10-25 Thread Hervé Le Cornec
Hello Brad, Thanks for your add. You are right : speaking is something, acting is an other thing. So go to oceanvirtuel.eu (Angular 7 + Node + Mongo, NOAA, ...), and judge the complexity by regestering to the next regatta. You will then tell me about complexity of web apps. Do not postulate

[AngularJS] Re: Store in Angular, with async processes : no Redux please

2019-10-25 Thread Brad Clements
Greetings, Reading this post, and your other one regarding observables makes wonder the point you wish to make. Certainly most angular 2+ applications do not need redux, nor a 'store' of any kind. This AiA podcast with Wes Grimes makes that rather clear

[AngularJS] Re: how to pass async value (promise) to click handler

2019-10-25 Thread Nhut Thai Le
Thank you Herve, I'm new to angular so i'm leaning something everyday :D. Just one question though. Since the "customer" variable may not be set when the view is rendered so the {{}} is the mechanism that angular is asynchonously watch the var and render when the value is available? If it is

[AngularJS] Re: Angular asynchronous : no "| async" please

2019-10-25 Thread Hervé Le Cornec
Hello Arnaud, I am not saying that your way of doing things does not work, I am sure that it works. I am also sure that, because you master it now, you code it fast, so you feel good with it. I just say that you spent certainly more time to implement your way, than using the way that I

[AngularJS] Web API Return 400 BAd Request

2019-10-25 Thread arjunender pabba
Hi c# Web API Returning 400: BAD REQUEST - The request could not be processed by the server due to invalid syntax from angular httpclient post method but the same is working with get method in Postman every thing is working fine Here is the angular code var headers = new HttpHeaders();

[AngularJS] Re: Angular asynchronous : no "| async" please

2019-10-25 Thread Arnaud Deman
Hi Hervé, With the observables I find it very easy to use the async pipe: you don't have to subscribe, store the result, keep the subscription and unsubscribe when the component is destroyed. I may have missed something but I use this extensively and I have not noticed any drawback yet.

[AngularJS] Angular asynchronous : no "| async" please

2019-10-25 Thread Hervé Le Cornec
Hello, Many discussions here a related to the use of async data in Angular, so let me recall the basics. Angular is natively designed to handle the async processes, because nearly everthing is async in javascript (loading, events, ...). To intend so Angular simply use the elvis operator

[AngularJS] Store in Angular, with async processes : no Redux please

2019-10-25 Thread Hervé Le Cornec
Hello, Redux is useless in Angular, worth, it can be harmfull, by causing a lot of useless complexity that will be handicapping. Redux is made to store the states of the variables of your application, but Angular is two-way data binding, so the states of the variables are watched natively.

[AngularJS] Re: how to use asycn pipe on a promise

2019-10-25 Thread Hervé Le Cornec
Oupps, the declaration of customer in the typescript of the component is of course useless, I forgot to delete it from an older version. -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and

[AngularJS] Re: how to use asycn pipe on a promise

2019-10-25 Thread Hervé Le Cornec
Here is the complete solution. 1) Angular store as a service import { Injectable } from '@angular/core'; @Injectable({ providedIn: 'root' }) export class StoreService { customer: any; constructor() { } } 2) Api service to get the data and store it inside the store (a timeout is used

[AngularJS] Using kerma unit test cases

2019-10-25 Thread Dev C
Hello there, I would like to write unit test cases in kerma, could you please help me any pointer for this ? I would like to have to write unit test cases for a component wherin we have more then one dependent services, ngbmodel, renderer2. Thanks -- Sent from my mi note 4 phone. -- You

[AngularJS] Re: how to use asycn pipe on a promise

2019-10-25 Thread Hervé Le Cornec
Now, if you use an *angular service* as a store, the async process is the same, you will just feed store.customer instead of only customer locally in your component. And in your template you will use {{store.customer?.name}} directly, so a change of this will be instantly and natively

[AngularJS] Re: how to use asycn pipe on a promise

2019-10-25 Thread Hervé Le Cornec
Here is your component, with a timeout to simulate an async process to get some user data : import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-mycomponent', templateUrl: './mycomponent.component.html', styleUrls: ['./mycomponent.component.css'] }) export class

[AngularJS] Re: how to pass async value (promise) to click handler

2019-10-25 Thread Hervé Le Cornec
Here is your component, with a timeout to setup the customer in order to simulate an async process : import { Component, OnInit } from '@angular/core'; @Component({ selector: 'app-mycomponent', templateUrl: './mycomponent.component.html', styleUrls: ['./mycomponent.component.css'] })