Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
ishu mishra
@coderishu
add(3).mul(5).divide(3) and output should be 5 ?
Implementation >>
let add = function(a){
return function mul(b){
return function divide(c){
return (a+b)/c
}
}
}
trying to implement this but not getting how to implement so that it should accept dot too
sorry a*b/c
add(3)(4) like this its working but why not with add(3).mul(3) like this
and sorry for this question which is apart from angular
ishu mishra
@coderishu
with currying only
raineer24
@raineer24
good evening :)
Max Ludwig
@dAnjou_gitlab
Hi there, what linting+formatting setup are people using? So far I've only found incomplete setups, like, only for js and ts but disregarding the templates and sass.
finlaydotb
@finlaydotb

Angular is an application that heavily uses the ReactiveX API via RxJS for handling asynchronicity. The API is deep in almost every layer of the framework: from the router to the handling HTTP.

On the other hand I have observed that the larger JavaScript ecosystem seems to be converging on async-await as the way to handle asynchronicity and little general adoption of ReactiveX patterns.

I know at some point Bel Lesh, one of the RxJS leads was pushing on having ReactiveX standardized within EcmaScript...but it seems that failed as he wrote here Observables, Reactive Programming, and Regret (https://dev.to/rxjs/observables-reactive-programming-and-regret-4jm6)

Which then leads me to wonder: was angular's decision to rely heavily on RxJS a bad bet? At the point that decision was being made, sure no one could tell how the future will turn out, but now it is increasingly looking like the larger JavaScript community won't be going the ReactiveX API route, won't this sort of box Angular into a corner of that framework that uses that quirk API nobody else really uses...

I am curious to hear what other people in the community thinks about this.

Miloš Lapiš
@mlc-mlapis
@finlaydotb But async-await is a synonym to make an async operation as a sync operation. It's useful in some cases but it's not certainly a replacement for observables.
Ed Cesar
@edcesar

Hello, I would like to use this exact component with two calendars in the material angle. I didn't find anything in the documentation, does anyone have any ideas?

image.png

Andrés Pérez
@Oxyrus
in case I'm using the async pipe to render data in my template (*ngFor="let course of courses$ | async"), what would be the best way to go about refetching the data? (this comes from an HTTP request)
Kamran Bahadori
@bahadorik
@syedabdulaala, Sorry for the delay and thanks for your suggestion. surely it's a great idea but I don't think it's the solution, I would like to combine multiple project to a single one and create single bundle. with microfrontends it is possible to split the code, I am trying to understand if it is the ideal solution for my purpose.
Daniel Willis
@danww
@edcesar It's not exactly the same, but you can now do date ranges with Angular Material: https://material.angular.io/components/datepicker/overview#comparison-ranges
Daniel Willis
@danww

@finlaydotb While Async/await and Observables are both used for handling asynchronicity, they are otherwise not really comparable. Observable patterns are much more suited to the way Angular works; filtering/transforming/combining/etc, your sources and finally subscribing to them with the async pipe in the template.
Conforming to Observable patterns is a change of paradigm, more like FRP. It also works wonderfully with the ngrx state management library.

As an Angular developer, I see them as different tools for different jobs. The observable pattern and rxjs are esssential, while I rarely - if ever - use async/await.

Alex
@alexcarrasco93
hi, I updated angular 9 project to angular 11 and something is going wrong when i build the project with --prod and --base-url /whatever/
now the request url for the images which are in assets are not with the base url
Alex
@alexcarrasco93
it only happens on my scss paths
seems like when i set a baseHref the assets won't know this baseHref
karimkouki-bit
@karimkouki-bit
what's the diferents between app.component.css and styles .css
Guilherme Bento Marques
@guilhermebentomarques

Hello Guys.. I'm having a problem when I have a "*ngFor" type check, in the full mode.
https://angular.io/guide/template-typecheck, Basically my code is

<app-component *ngFor="let item of items" [item]="item" >
</app-component>

The type of the items is an x[] and the type of the input [item] is x, and I have the error message.. type x[] is not assignable to type x[] | Iterable<x>, any idea why I have this issue?

Raj
@rajjaiswalsaumya
hello, can someone please tell me how to make shorthand imports work for library projects
?
in my case, my all apps where lib is imported fails to build
Ryan Pierce
@piercers
@rajjaiswalsaumya I think that's done with this: https://www.typescriptlang.org/tsconfig#paths
DrewMoody
@DrewMoody
I feel dumb for asking... but how do you type this?
type ComparerFn<T> = (a: T, b: T) => number;
// how to specify a helper is of type ComparerFn<T>? Not sure about the generic part, says cannot find T
const helper: ComparerFn<T> = (a: T, b: T) => whatever
Ryan Pierce
@piercers
@DrewMoody const helper: ComparerFn<MyCustomType> = (a, b) => {}, I think.
DrewMoody
@DrewMoody
That's one thing I tried. It doesn't work, says T doesn't exist... So it wants T to be defined sooner. I am just not sure where you'd define the generic in that event. Maybe it's a quirk of TS. Or maybe I have to give it a default of any? I don't know. I can work around it
3 replies
DrewMoody
@DrewMoody
One more... Is there any way to do something like this?
// way to define prop as being a keyof T that has a value of string?
function stringPropertyComparerFn<T, K extends keyof T>(a: T, b: T, prop: )
Ryan Pierce
@piercers
@DrewMoody Not sure about that one -- but it sounds cool. I've tried to do that recently as well and got the impression function overloads were the way to achieve that.
Gabriel Araujo
@gabrielaraujof
Hello, does anyone know if there is any possibility of getting an undefined NavigationTransition when router is trying to apply redirects? I'm getting this error: TypeError: Cannot read property 'extractedUrl' of undefined. Looking at the router source code (https://github.com/angular/angular/blob/master/packages/router/src/router.ts#L583) it seems like it's getting the navigation object as undefined inside the applyRedirects function. But how is that possible? I've read the source code many times already trying to figure out how could it be undefined but I haven't understood.
Could anyone help me to crack it out?
freshdev1
@freshdev1
can anybody go through this stackblitz example and let me know what wrong I am doing with FormArray:
https://stackblitz.com/edit/angular-q9wmok-idtrup?file=src%2Fapp%2Fprop-array-add.component.ts
idea is to remove the old array controls, objects and insert a new one with a value
it won't let me do it.
I am using a RxWeb library, but its just a wrapper above the Angular's own Forms module. If anyone can get it to work with Angular's FormArray it would be great.
Oh - sorry, I misread - one sec...
freshdev1
@freshdev1
i want to get rid of the old ones.
Daniel Willis
@danww
Check it now.
I remember having this issue before - you need to iterate over the formArray and removeAt()
freshdev1
@freshdev1
Hmmm it works on this simplified example but it won't on my local project.
Daniel Willis
@danww
Hmmm - can you spot what is different?
freshdev1
@freshdev1
Works now. I was using formArray.clear() to clear out old objects. which was causing some issue, I don't know.
Was also using it with removeAt
Final working code:
onDocumentUpdate(documentsArray: DocumentModel[]): void{
    if(documentsArray == undefined)
    {
      return; 
    }

    var docsControls = this.contractForm.controls["TenantContractDocuments"] as FormArray;

    while(docsControls.length !== 0)
    {
      docsControls.removeAt(0);
    }

    documentsArray.forEach((element: DocumentModel) => {
      let docGroup = this.formBuilder.formGroup(DocumentSubmission);
      let document = element as DocumentSubmission;

      docGroup.patchValue(document);
      docsControls.push(docGroup);
    });
  }
Daniel Willis
@danww
I don't think formArray.clear() is a thing, unless it's in the RxWeb library?
freshdev1
@freshdev1
What was not working:
onDocumentUpdate(documentsArray: DocumentModel[]): void{
    if(documentsArray == undefined)
    {
      return; 
    }

    var docsControls = this.contractForm.controls["TenantContractDocuments"] as FormArray;

    docsControls.clear();
   docsControls = new FormArray([]);

    while(docsControls.length !== 0)
    {
      docsControls.removeAt(0);
    }

    documentsArray.forEach((element: DocumentModel) => {
      let docGroup = this.formBuilder.formGroup(DocumentSubmission);
      let document = element as DocumentSubmission;

      docGroup.patchValue(document);
      docsControls.push(docGroup);
    });
  }
I read it on some of the answers and tried.
Its from the angular itself
Daniel Willis
@danww
Yeah, docsControl needs to remain a reference to the existing formArray
hmmm makes sense, I was reassigning it to the parent form even after initializing a new one. But that too was not working.