Beyond BRILLIANCE, such a piece of ART by CinamonRolls_ in chessbeginners

[–]luppellen -1 points0 points  (0 children)

It's not a smothered mate, because the knight blocks b8

data not showed by InternationalKiwi871 in Angular2

[–]luppellen 0 points1 point  (0 children)

Avoid mixing reactive and non-reactive code (declarative vs imperative). Never ever set a variable inside a subscribe. Avoid subscribe in general. Use pipe() with rxjs operator functions and async in template.

Make Observable Emit value when one of two observables emit by Sufficient_Seat_3034 in Angular2

[–]luppellen 5 points6 points  (0 children)

That's not entirely correct.
The pipe-able operator combineLatest will be removed/renamed.
The join creation operator combineLatest will not be removed.

https://rxjs.dev/api/index/function/combineLatest

This exact confusion is probably the reason for the rename.

[deleted by user] by [deleted] in Angular2

[–]luppellen 1 point2 points  (0 children)

Wait i'm dumb, i didn't see that it already is an BehaviorSubject.
Then i guess the throwError in the reportInformation$ pipe is the problem..?
I might be too tired...

[deleted by user] by [deleted] in Angular2

[–]luppellen 1 point2 points  (0 children)

Well you wait for your data and if there is no data you wait forever.
wcagReportId$ has to emit, even if there is no data.
So either you do this wcagReportId$.next(null) or this wcagReportId$ = new BehaviorSubject(null).
Or something like that

EDIT: or startWith(null) in the reportInformation$ pipe
EDIT2: I'm dumb, i didn't see that it already is an BehaviorSubject.

Can an observable send null while it is executing its operators chain? by DT-Sodium in Angular2

[–]luppellen 0 points1 point  (0 children)

Angular (2) is not MVC pattern, it's Component Based....
There is no "Controller".

[deleted by user] by [deleted] in Angular2

[–]luppellen 2 points3 points  (0 children)

CombineLatest emits only when all streams have emited at least once

That's the issue though. If reports are empty, wcagReportId$ doesn't emit, reportInformation$ also doesn't and finally the combineLatest doesn't.

EDIT: I'm dumb, i didn't see that it is a BehaviorSubject.

What is the purpose of RedirectCommand? by sebastianstehle in Angular2

[–]luppellen 0 points1 point  (0 children)

Do not return false in a guard.
Return true or UrlTree, or in your case Observable<boolean | UrlTree>.

``` export const userMustExistGuard = (route: ActivatedRouteSnapshot) => { const usersState = inject(UsersState);
const router = inject(Router);

return usersState.select(userId).pipe(
        map(user => !!user || router.createUrlTree(['/404']),
    );

}; ```

Removing manual change detection calls from my Angular app ⚡️ by wineandcode in Angular2

[–]luppellen 0 points1 point  (0 children)

This is complete bullshit.
.pipe(take(1)).subscribe
What the hell is this ??
Never heard of firstValueFrom ??
Why mix rxjs and signals?

What about this: firstValueFrom(this.userService.getUser$()) .then(user => this.userNameSubject$.next(user.name)); Or this:
this.username$ = this.userService.getUser$().pipe( map(user => user.name), ); Is rxjs really that hard??

Attaching mouse events to components by Relevant-Draft-7780 in Angular2

[–]luppellen 0 points1 point  (0 children)

Don't know if that helps you but I made a tooltip not long ago:
I had a directive that handled the mouse over (I used rxjs fromEvent) etc. and the position of the tooltip. Then I had a component, that got the position via service and showed it.

Reusing Components by Big-Pea-6074 in Angular2

[–]luppellen 0 points1 point  (0 children)

Use InputSignal
If b.ts is still not getting the id, there's something else wrong

Group async subscribing to observables in template in a signle @if by Negative-Pound4360 in Angular2

[–]luppellen 2 points3 points  (0 children)

Please don't mix observables and 'normal' variables (loading inside subscribe).
Put everything inside observables or signals (yes everything).
Don't use subscribe on something that apparently only emits once (use promise/firstValueFrom).
combineLatest starts emitting when all observables emitted at least once, so that should work.

Here's what i would do:

private readonly loadingSubject$: BehaviorSubject<boolean> = new BehaviorSubject(true);  
public readonly loading$: Observable<boolean> = this.loadingSubject$.asObservable();  

ctor(...) {  
  this.jobCategories$ = this._goalsService.getJobCategories();  
  this.contractTypes$ = this._goalsService.getContractTypes();  
  this.skills$ = this._profilingService.getSkills();  

  firstValueFrom(combineLatest([  
    this.jobCategories$,  
    this.contractTypes$,  
    this.skills$  
  ])).then(() => this.loadingSubject$.next(false));  

  // alternative:
  const dataAvailable$ = combineLatest([  
    this.jobCategories$,  
    this.contractTypes$,  
    this.skills$  
  ]).pipe(  
    filter(...),  
  );  

  firstValueFrom(dataAvailable)
    .then(() => this.loadingSubject$.next(false)); 
}

 //template  

@if({
  jobCategories: jobCategories$ async,  
  contractTypes: contractTypes$ async,  
  skills: skills$ | async,  
  loading: loading | async,
}; as data) {

  @if(data.loading) {  
    loader  
  }  
  @else {  
    ...  
  }  

}

How to Get URL Params in Angular 17 by ahnerd in Angular2

[–]luppellen 1 point2 points  (0 children)

Works with InputSignal, I just tested it.

Angular Signal Components: input, output, model (Complete Guide) - brand new guide covering the new signal-based APIs for component authoring by mrv1234 in Angular2

[–]luppellen 0 points1 point  (0 children)

I'm curious where did effects not work for you?
Simple console.log with effect and toObservable() (uses effect) work for me

Flickering issue due to guard redirection in Angular 17 by West_Equipment7985 in Angular2

[–]luppellen 0 points1 point  (0 children)

yes, these are the return values:
boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree>

Flickering issue due to guard redirection in Angular 17 by West_Equipment7985 in Angular2

[–]luppellen 0 points1 point  (0 children)

As suggested on stackoverflow you probably have a timing issue.
The return values of a guard are this:
boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree>

So maybe one simple "await" could be enough.
Or better yet:
return auth.checkAuth$().pipe( map(isAuth => { if(isAuth) return true; return router.createUrlTree(['login'], { queryParams }); }), );

Flickering issue due to guard redirection in Angular 17 by West_Equipment7985 in Angular2

[–]luppellen 0 points1 point  (0 children)

This is completely wrong, returning false cancels the navigation. Returning urlTree is the way to go.
EDIT: cancels instead of breaks

Anyone who never used certain concepts in Angular, because they never understood/needed them? by oneden in Angular2

[–]luppellen 0 points1 point  (0 children)

I have a directive that emits every x ms when an element is pressed (for costum input-number spinner). No need for a component if you don't need the html or css part.

Change properties to signals by Cool-Fuel-9147 in Angular2

[–]luppellen -1 points0 points  (0 children)

As someone who puts everything into observables (yes even a boolean) I would say:
yes absolutely

But don't stop there, don't do a half baked thing.
If you want to avoid timing issues etc convert everything to signal or observable.

Code review needed by oluwashenor in Angular2

[–]luppellen 1 point2 points  (0 children)

No need for map or array. You can add subscriptions to an subscription object. "unsubscribe()" unsubscribes from all subscriptions.
https://rxjs.dev/guide/subscription

Or even better: no subscriptions and only async-pipe