I recently refactored an Ionic Angular app that previously made use of jQuery to fetch data and update the view 😔. Having moved the API calls into dedicated services, all API requests were blocked by the browser given the different origins (localhost vs external api url).
Here’s how to dynamically create a
div, set it’s
id property, and append it to the
body element in an Angular service or component. I’ll use the example of creating a recaptcha container div on the fly.
If you want to pass additional parameters to an Angular service, what you are looking for is @Inject decorator. It helps you pass your parameters to the service through Angular’s dependency injection mechanism.
I’ll start by saying YAML is awesome! It’s like that thing you’ve been looking for but never knew existed, at least for my use case.
The past couple of weeks I’ve been adding new functionality to an API and today began updating the Angular front-end application to reflect these changes.
So I’ve been working with Akveo’s Nebular UI Kit for a while now and it’s been a real issue adding custom content to
While using the Twitter web app, I noticed it displays a
Try Again button for failed requests in different sections of the user interface. This allows the user retry each failed request without affecting the rest of the application, quite neat.
Wouldn’t it be great if instead of doing
ng serve --proxy-config proxy.conf.js you simply use
ng serve and the Angular CLI takes care of the proxy redirect command? Well, you can.
I’ve had this longstanding issue with setting the size of modals created with NbDialogService.
To test your Angular build locally:
There are many articles on the web showing various methods of getting a reference to the window object in Angular (primarily through the dependency injection mechanism). However those that are popular on Google search are from 2016, 2017, etc, and the methods are mostly overly complicated (understandably).
Lately i’ve been trying to apply the concept of using the url as the single source of truth in Angular applications I work on. Today I wrote some functionality that demonstrates this quite well.
<time [dateTime]="'2019-08-09 16:22:20'">8/9/2019</time>
A few days back while looking into strongly typing reactive forms in Angular, I came across this post by Alex Klaus. Given reactive forms don’t currently support strong typing (see issues #13721 and #17000), he suggests making use of Daniele Morosinotto solution which involves leveraging Typescript declaration files (
Ever had this issue where for some reason you can’t navigate to a route even though everything seems ok, and the route’s data resolvers are all executing?