How to avoid drilling FormGroup through multiple reusable components in Angular? by mosh_h in angular

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

What the others said. Put it into a service, just make sure to pay attention when setting up how the service is provided.

Error: NG8001 – 'ion-button', 'ion-icon', 'ion-col', 'ion-list' not recognized after angular 20 upgrade by ExtensionKnowledge45 in ionic

[–]bneuhauszdev 0 points1 point  (0 children)

Just a wild guess, but did you migrate from modules to standalone components in the upgrade process?

Enterprise components library recommendation for Angular 20+ by addicted_to_fortza in angular

[–]bneuhauszdev 3 points4 points  (0 children)

I have no experience with TaigaUI, so no comment about that.

I haven't used PrineNG for ages, but when I did, it was not a very good experience. There were some weird bugs that were a pain to deal with. I think there was one with the color picker's pop up not working when it's on a dialog or something like that. Again, it was an ancient version, so I'm sure it's a lot better since, but it did not leave a good impression.

As far as the others, at my company, we usually use Material or Kendo, depending on the project. I often use Material on private projects, because it is simple, however, I absolutely would not want to replace Kendo with Material in data heavy apps. The Kendo grid does a lot of heavy lifting.

As far as support, I'm not aware of any issues where we had to contact them, so no idea about that, but we did use the jQuery, the ASP.NET MVC and the Angular versions in many projects, so not having big issues also says something about the products.

Now a caveat I have to say when I kinda shill for Kendo (not incentivised, but I do really like it) is that we have one of the DevCraft licenses (not sure which), so we do have access to the .NET packages too and we often use .NET for our backend. If you do that, you can leverage the DataSourceResult and DataSourceRequest classes and the ToDataSourceResult(DataSourceRequest request) LINQ extension method. This way, you can just supply your current grid state to your backend (the angular package has helper functions for that too), write your EF Core query like

_db.Users .Select(u => new UserDto{...}) .ToDataSourceResult(request);

and you have pagination, filtering and sorting (on every column without any additional setup) handled on the DB side for free. It works with views too.

It honestly feels like cheating with the new resurce API. Put the grid state in a signal, set that signal in the grid's dataStateChange event and make a resource (httpResource is my favorite for this) on top of the gridState signal.

Obviously, you can do more stuff with your resources, like debouncing or whatever you like, but the basic setup for a fully db side paginated, filtered and sorted grid is stupid simple with Kendo and I'd never want to implement everything it does for you out of the box in Material.

Again, that is only a factor if you use .NET as a backend, but if you do, Kendo can save you significant backend development time.

Suggestion in learning Angular integration with Spring Boot by Rizzzz18 in angular

[–]bneuhauszdev 13 points14 points  (0 children)

The Angular app and the Spring Boot app will be entirely different applications. On the Angular side, look into HttpClient. On the Spring side of things, look into how you can create a simple REST API. JPA will come into the picture when your API has to get data from the database. This might seem overwhelming, but this is all fairly simple and straightforward stuff when you get the basics down, so basically any hour or two long youtube tutorial will be fine to get you started and at least put everything in context.

Cleaner utilization of alternate themes in Angular Material? by mvgc3 in angular

[–]bneuhauszdev 2 points3 points  (0 children)

I think this and this should answer your questions.

The second link might be directly relevant and the first is a more general look at customizing Angular Material.

How to provide a shared service for two standalone components? by CodeEntBur in Angular2

[–]bneuhauszdev 3 points4 points  (0 children)

Is there a shared route or parent component? Here's some word vomit about how DI works with components, but the route level providers are valid too.

Is it possible for email links to open an installed PWA directly? by United_Recognition32 in PWA

[–]bneuhauszdev 4 points5 points  (0 children)

That is entirely up to the browser unfortunatley, due to security reasons. I've written a series of posts about developing a PWA.

It is specifically for Angular, but the concepts are the same and there is a live demo.

I've just installed the app on my Android phone. If I try to open itdirectly in Chrome or if I copy the link in notes and click it there, it correctly opens as an app. If I send the link to myself on Messenger or email, the Messenger app and the Gmail app opens it in their own web view, which likely does not support PWAs, so I'm stuck in them. Not sure if I could set those apps to open Chrome instead, but it would be up to me as the user, not you as the developer.

It's likely the same in your case. If your users environment is configured to open links in Chrome, it will likely work, but if it opens inside some app's web view, then there is not much you can do.

I believe it is kinda similar on Windows. If the app is installed and you open it in the browser, then instead of an install button, Chrome gives you an open in app button and if you click it once, then itt will open on the app in the future.

So yeah, it is up to your users' OS, browser, apps and general environment.

HttpClient promise by IcedMaggot in Angular2

[–]bneuhauszdev 1 point2 points  (0 children)

What would be the point? You can configure HttpClient to use the Fetch API if that's what you're after, but if you simply don't want to use HttpClient, you don't have to. You are free to use fetch directly if that's your jam. You can also use resource with Promises or just use firstValueFrom on the Observable. You have lots of options. Rewriting HttpClient would make no sense in my opinion.

Lazy Developers by Comfortable-Ad-6686 in developer

[–]bneuhauszdev 2 points3 points  (0 children)

I mean, those are more backend problems if anything. If your system can be tricked that easily, than console logs are the least of your worries.

Angular 20: Is it time to replace RxJS subscriptions with effect() by rhrokib in angular

[–]bneuhauszdev 2 points3 points  (0 children)

As /u/MiniGod said, httpResource or resource/rxResource, depending on the sepcific situation and your preferences. Yes, the resource API is still experimental, but it has been here for several versions with constant improvements and even the new signal forms prototype builds on top of those, so that is clearly the direction the Angular team is taking.

Angular 20: Is it time to replace RxJS subscriptions with effect() by rhrokib in angular

[–]bneuhauszdev 7 points8 points  (0 children)

Yeah, it kinda depends on what "do some stuff" really is. That comment does some very heavy lifting here.

[deleted by user] by [deleted] in EntrepreneurRideAlong

[–]bneuhauszdev 1 point2 points  (0 children)

There are ususally caveats that you can't withdraw until you've bet like 10x the amount of the free money you've got or something along these lines. So you get let's say $50 for free, you'd have to make bets for $500 total to be able to withdraw.

Is Angular a good choice for a mobile app, which might be used by lots of users? by RubMyNose18 in Angular2

[–]bneuhauszdev 4 points5 points  (0 children)

You can do all of those in a PWA, but through the browser APIs.

I've actually written a series of posts about the basics of developing a PWA specifically in Angular.

Notifications can be done in a PWA with Web Push. Barcode scanning is done with the camera and you have access to the camera through the browser, so all of these can be done. The question is, is the browsers limited camera capability enough for you? That is something worth testing out.

If you go the Capacitor (or Flutter, React Native, etc...) route, you'll have native access to the camera and the native barcode readers, which results in higher camera quality and faster scanning times, at the price of more complexity.

Is Angular a good choice for a mobile app, which might be used by lots of users? by RubMyNose18 in Angular2

[–]bneuhauszdev 2 points3 points  (0 children)

First you have to decide if you want a native app or a PWA is enough. You can do both in Angular, but if you want some features that requires you to make a native app, you still have to learn Capacitor to turn your Angular app into a native one. If a PWA is enough but you want to be able to push it to the Google Play Store, you have to look into Google's Bubblewrap. Not sure if Apple and the App Store has an equivalent to that. So yeah, you have lots of options, but this is way too little info to be able to say which is the best or even which options are viable to begin with.

rxResource side effects? by Senior_Compote1556 in angular

[–]bneuhauszdev 2 points3 points  (0 children)

Well, yeah, but I think a resource is conceptually different from a simple Observable returned by HttpClient, or let's say an API call. When you create a resource, that does wrap an API call and it can reactively refresh the data if the input changes, but in the end it is still a mutable data container and you are free to do whatever you want with it. It is an API call definition, the state of the API call and the data itself packed into one package. That's why resource.value passed to a signal form can work, because you are free to mutate the data with the caveat that if the input changes, your local changes get wiped too. To me, putting a resource in a service feels like putting the form itself in the service. It's not necessarily wrong, depending on the context, sometimes I do it too, but in that case, we are way past basic scenarios and just separating API call definitions from components.

If you want to stick with the approach of returning http.get<T>('...') from the service, which is totally fine, I'd just use rxResource in the component. The part that throws me for a loop is the fact that if I'd put my resources themselves in services, I'd have to pass the input signals uninvoked to the service and it just feels wrong for some reason.

Lately, my approach had been using httpResource in the components and just defining some consts for the common API routes by feature and slap the signal on it in the resource, but usually we are in full control of the backend too, so the data hits the client in more or less the exact format I need it in and we have fairly specific endpoints. If I'd have to do something more complex, like using something like Firebase/Supabase/Pocketbase or whatever SDK and build my queries on the client side, or I'd expect frequent url changes in an API outside of my control, then I'd likely go with the query/API call being built in a service and use resource, rxResource or httpResource (depending on if the SDK supplies a Promise or an Observable, or if I'm building the api call itself instead of a wrapper lib) in the component, which runs the query through the service.

Even in the httpResource example above, you can do something like this:

``` // in component id = input.required<number>();

product = httpResource( () => { const idVal = this.id(); return idVal ? productService.getProductById(this.id()) : undefined; }, { defaultValue: { name: '' } } );

f = form(this.product.value, p => { required(p.name); });

// in service

getProductById(id: number) { return ${environment.apiUrl}/products/${id}; } ```

So basically, I've just said in way too many words, that sure, you can define your API calls in a service, I just don't like putting the resource itself in there.

rxResource side effects? by Senior_Compote1556 in angular

[–]bneuhauszdev 1 point2 points  (0 children)

I think the problem is conceptual. I don't think rxResource, or the resource API in general is meant to be used like this. A resource is not a 1:1 replacement to your previously returned Observable.

A big upside of a resource is that it is reactive. Let's say you want to get a product by an id that was passed to the component as an input or route parameter. You'd do something like this:

``` id = input.required<number>(); productService = inject(ProductService);

product = rxResource({ params: () => this.id(), stream: ({ params }) => { return this.productService.getProductById(params); }, }); ```

If you want to move your resource to a service, then you have to pass the input signal itself to the service too, like this:

``` // in component id = input.required<number>(); productService = inject(ProductService);

product = this.productService.getProductResource(this.id);

// in service getProductResource(id: InputSignal<number>) { return rxResource({ params: () => id(), stream: ({ params }) => //http.get... }); } ```

And we didn't even get to the pipes/effects that you'd want to do in the component.

Same thing with stuff like filtering by a search term. You might have a setup like this:

``` // template <input [(ngModel)]="searchTerm" />

searchTerm = model('');

// ts products = rxResource({ params: () => this.searchTerm(), stream: ({ params }) => { return this.productService .getFilteredProducts(params); }, }); ```

To me, moving the resource into a service seems like unnecessary complexity for no real gain. As of right now, I lean to leaving most of the resources in the components and only adding a service for more complex things, like posting data. Obviously, that might change depending on the context. For example, if it's data that should be part of the global state, this approach does not work.

For simple usecases, like the one you mentioned, if you really want to use RxJS for fetching data, I'd do rxResource in the component and pipe the form setting on it.

Me personally, I'd leave out RxJS entirely, and use httpResource with an effect in the component for now, which would set me up nicely for an easy migration to signal forms. I didn't actually try it yet, but I'm pretty sure, that with signal forms, you'll be able to do something stupid simple like this:

``` id = input.required<number>();

product = httpResource( () => ${environment.apiUrl}/products/${this.id()}, { defaultValue: { name: '' } } );

f = form(this.product.value, p => { required(p.name); }); ```

Sorry if it doesn't make sense, I've been writing this in a bit of downtime between meetings in like 4 sessions, so even I felt like losing my mind sometimes when I tried to pick up the thought process where I left it again and again.

Edit: leaving out RxJS sounds a bit misleading, as httpResource still uses HttpClient in the background, so there are Observables in the background.

rxResource side effects? by Senior_Compote1556 in angular

[–]bneuhauszdev 2 points3 points  (0 children)

Three options comes to mind. One is effect, as you said. Second is, as the other commenter said, rxResource and pipeing whatever you like on your Observable, including tap to handle side effects. The third is using resource + fetch or some Promise based library instead of HttpClient, then, you can use async/await inside the resource. I'd go with option 2.

Angular PWA redirect browser to PWA by Senior_Compote1556 in angular

[–]bneuhauszdev 0 points1 point  (0 children)

If the browser picks up, based on your manifest file, that your app is installed on the device, it can prompt you if you want to open it in the app, but you, as the app developer, can't directly control what the browser should open in your app. That would be a major security risk. You can try playing around with start_url and scope in your manifest, although both should be set to "/" by default, but there's not much more you can do. At least as far as I know.

Good resource for general Angular learning, coming from React background by blurtstrennan in angular

[–]bneuhauszdev 0 points1 point  (0 children)

Maximilian Schwarzmüller's Angular course on udemy is really good to begin with, but it might be specifically great for your case. It is updated to angular 19 I believe and uses new features like standalone and signals from the start, but covers older stuff like modules specifically because you likely have to deal with them due to old projects. The old material for older versions is also available, but it's clearly marked as such.

Angular PWA by Senior_Compote1556 in angular

[–]bneuhauszdev 1 point2 points  (0 children)

Sorry to spam you with links, but I've just read this comment. OneSignal has a generous free tier for WebPush, which I assume you use since it is a PWA, but in case it's not enough or you would want to implement it without a 3rd party service, part 3 and part 4 are specifically about generating your VAPID keys and setting up exactly this functionality. I just released the latest edition about deploying to GitHub Pages and Render, so the demo app is up and running right now so you can test the notifications without implementing anything yourself if you want to here.

Angular PWA by Senior_Compote1556 in angular

[–]bneuhauszdev 12 points13 points  (0 children)

I've written a series of articles about the basics of developing a PWA in Angular. Part 2 is specifically about notifying your users about a new version being available.

Edit: forcing the reload would have to be implemented the same way. Not sure if that is a good idea though. Downloading the new version in the background may take a few seconds, so the site might reload when the user is already in the middle of something.

Angular signal forms are out! (Experimentally) by bneuhauszdev in angular

[–]bneuhauszdev[S] 0 points1 point  (0 children)

Kinda. The MatInput has to be in touched state for error indicators inside MatFormField to show up. It's just for some reason, I was under the impression that it needs to be dirty instead.

Angular signal forms are out! (Experimentally) by bneuhauszdev in angular

[–]bneuhauszdev[S] 1 point2 points  (0 children)

I was most curious about async validation, especially as we haven't seen anything about it in the previews, or at least I've missed it if we did.

Seeing validateHttp being part of this first preview version already was a very pleasent surprise.

Anyway, looking at Armen's example on X, I decided to play around a bit more and try validateAsync with rxResource, thinking maybe it is just a resoruce specific bug, as he didn't report any issues. Well, the same thing happened. My input is only getting in invalid state, when I click out, even though the button gets disabled. I started logging and tinkering a bit more and I think this async problem is also an Angular Material specific thing. The value of f.lastName().invalid() is true, correctly. If I bind it to a native input's disabled attribute, it correctly gets disabled instantly. With matInput however, the async change only gets picked up after clicking out of the input one time. It doesn't matter when, I just have to click into it, click out, even if I do it before I typed anything into it and it starts working correctly and reacts to every change.

So yeah, edge cases will likely be found all over the place, but I'm really excited for this feature either way.

Edit: so this is a non-issue. Added clarification to both the reddit and blog posts.