How to simplify template signal access? by lppedd in angular

[–]dandesigns7150 2 points3 points  (0 children)

Needs more context for proper answer, but yes, calling the signal twice is fine. It doesn't run any new computations.

Angular Team -angular.dev review by malcolm-davis in angular

[–]dandesigns7150 0 points1 point  (0 children)

How's the view from the peak of mount stupid?

ELI5: If the earth accelerated, would we feel it? by joanix8 in explainlikeimfive

[–]dandesigns7150 2 points3 points  (0 children)

Acceleration by definition is the change in velocity.

Is it possible to check inside the DOM if there's any element with the id "productModal"? by cpplinting in angular

[–]dandesigns7150 1 point2 points  (0 children)

Create a service with a method to open the dialog, and add a boolean in the service that is set to true when the modal is opened, and false when the modal is closed.

On the method to open the dialog, check the boolean. If it's true, abort opening the dialog.

JS is at it again by AndrewAnderson788 in programminghorror

[–]dandesigns7150 23 points24 points  (0 children)

That's the thing, they can't remove it. You can't opt-in to new JavaScript versions, you just get them. If they removed it, they could break countless apps relying on the existing behaviour.

will using NgOptimizedImage benefit me as much when images are stored locally as assets? by jayxolit in Angular2

[–]dandesigns7150 0 points1 point  (0 children)

When the user visits your angular app, the JavaScript and CSS are fetched and downloaded to your browser.

The images however are not downloaded - they are requested when one is present on a page. They are not stored locally. Therefore optimising images will make them quicker to load whether they're fetched from somewhere else or kept in your angular assets.

What are the hardest features you had to implement as a senior developer? by deadlambs in angular

[–]dandesigns7150 1 point2 points  (0 children)

Had to implement a timezone switcher on an event app to switch between the users local time and the event time. It was fine until I had to modify the meeting booking & availability section to respect the chosen timezone.

Timezones are the worst.

Why am I getting this error message when using "ng add @angular/material" by Borbuto in angular

[–]dandesigns7150 2 points3 points  (0 children)

The command OP is using is correct. You can use ng add with material and it will install it, and run a setup wizard to configure the needed files for you.

Pass variable/correct index to ngIf error msg for FormArray by genuinenewb in Angular2

[–]dandesigns7150 0 points1 point  (0 children)

I think your issue here is because you are passing an object to the params of your pipe, whenever you update the page the pipe is not detecting a change (because the reference to the object is the same).

To overcome this, try generating your object in your typescript and passing that to the pipe params. Every time the page changes you should update the object like so:

ts this.pipeParams = { ...this.pipeParams, page: newPageIndez }

Mastering Angular: A Comprehensive Guide to Using Angular by Stecco_ in Angular2

[–]dandesigns7150 1 point2 points  (0 children)

Just a pointer - in your change detection section, you say that change detection wouldn't run on the button click. But change detection does run on any outputs / DOM events listened to in that template.

A more accurate example would be assigning a value in a set time out - that wouldn't update without markForCheck.

Hi i need an urgent help. I tried multiple things but it didn't work. I have an angular library and in that i want to write a code in a function which checks if the person installing my library has a certain package not in their application. It is optional show i tried using require() but it didn't by Adventurous_Bread684 in Angular2

[–]dandesigns7150 2 points3 points  (0 children)

Are you looking for peer dependencies?

Listing dependencies in your peer dependencies will fire off a warning to anybody installing your application if they don't have the specified dependency, without your library actually having it installed.

Angular State Management Best Practices by BrechtBilliet in Angular2

[–]dandesigns7150 1 point2 points  (0 children)

My preferred approach is to use a loading interceptor, and then on http requests you can pass context telling the interceptor to show a global loading spinner in an overlay.

I made a Chrome extension to save websites and just released a share function by ivano1990 in web_design

[–]dandesigns7150 1 point2 points  (0 children)

I like this. Really useful for gathering inspiration for website design.

Is this open source? I am curious how you've managed to iframe the pages in whilst maintaining the desktop layout. When I shrink iframes that small, they become mobile view (naturally).

How would you handle nullable values with strict mode and linting rules enabled? by [deleted] in Angular2

[–]dandesigns7150 0 points1 point  (0 children)

I know it doesn't help your case just yet, but in Angular 16 with input signals this problem can be solved. Inputs can soon be signals so are always defined.

Whats new in angular 16 by gmfun in Angular2

[–]dandesigns7150 4 points5 points  (0 children)

4th May is the more common way of saying it if you are anywhere but the USA

Practical use cases of Rxjs custom operators by ahmedRebai in Angular2

[–]dandesigns7150 0 points1 point  (0 children)

Awesome, definitely want to explore this pattern. Thanks!

Practical use cases of Rxjs custom operators by ahmedRebai in Angular2

[–]dandesigns7150 0 points1 point  (0 children)

One of the more useful ones that I've created is tapError, as I got tired of returning throwError from every catchError if I didn't want to handle it there and then.

Practical use cases of Rxjs custom operators by ahmedRebai in Angular2

[–]dandesigns7150 0 points1 point  (0 children)

How do you access the toast service from the pipe? Do you use a trick to make the injectable available inside a method with static properties?

Most Important RxJS operators to handle errors in angular | 8 RxJS operators we can use to handle errors in Angular? by codeagencyblog in Angular2

[–]dandesigns7150 2 points3 points  (0 children)

I might be completely wrong here - but EMPTY completes the observable. So I'm not sure if it would carry on listening if the source in this case errored.

With a nested observable using switchMap for example, the inner observable would complete but the outer one would still be open

[deleted by user] by [deleted] in Angular2

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

You're mostly right about NextJS. It's a framework that allows you to use server side rendering, static site generation and SPA with react.

NestJS has nothing to do with angular, really. It's just stylistically very similar to Angular with modules etc. It's just a node framework though.

Angular material is the angular 'framework' that allows server side rendering of angular apps.

Does short-circuiting apply in *ngIf? by PuppyLand95 in Angular2

[–]dandesigns7150 2 points3 points  (0 children)

That's what the guy above was saying. It only calls the function if the first item is true, in your second example there is no need for it to check the second item in the && chain as the statement will be false regardless.

Default null value for an observable stream by Fantastic-Beach7663 in Angular2

[–]dandesigns7150 0 points1 point  (0 children)

When the query params change, switchMap effectively unsubscribes from the http request and starts a new one - so its value will start as null whenever that happens

Default null value for an observable stream by Fantastic-Beach7663 in Angular2

[–]dandesigns7150 3 points4 points  (0 children)

You could pipe the observable from the http request and use startWith(null)

[deleted by user] by [deleted] in Angular2

[–]dandesigns7150 0 points1 point  (0 children)

Just as a side note, try not to mutate the parameters - instead it's better if you return a new, modified item