With Angular 5 version having implemented a new Service Worker customized for Angular apps and @angular/cli 1.6 building it into your Angular app, a further step towards Progressive Web Apps has been made. Why is this important? Progressive Web Apps (or PWA) are seen for many years now as the evolution of apps, bound to […]
Fetch data with the new HttpClient on Angular 5
Note: given the semver adopted from now on by Angular team, I will refer to all versions of Angular2+ as Angular. For the old Angular 1.x, I will use AngularJs The new HttpClient on Angular 5 is here to replace the deprecating @angular/http module. The new HttpClientModule will be imported from @angular/common/http. For the purpose of this article, we are going to use […]
Angular how to dynamically inject a component to DOM
Note: given the semver adopted from now on by Angular team, I will refer to all versions of Angular2+ as Angular. For the old Angular 1.x, I will use AngularJs In this post, we’ll take a look on how to dynamically inject a component into the DOM using a directive as a placeholder and ViewContainerRef Angular class. For simplicity, we will declare a new […]
How to apply flex on Angular component
Note: given the semver adopted from now on by Angular team, I will refer to all versions of Angular2+ as Angular. For the old Angular 1.x I will use AngularJS. Supposing you want to use the flexbox CSS property to style your Angular app. So you will have a cascade of flex element that at some […]
Angular Jasmine Karma test when component has own module
Always remember that your TestBed.configureTestingModule() is there on your test to recreate your module the same way is created on the app. Let’s assume that you have a structure like following: – your.component – your-child1.component – your.child2.component -your.pipe -your.module In your.module you will import and declare all your three components and the […]
How to watch for changes an array/object on Angular 2
In the good old days of Angular.js we had the $scope.$watch mechanism to follow the changes in our variables. For Angular 2 all this has been changed for performance reasons. So, you will be left wondering how to watch the changes on your array/object, needed on every application. You start googling for a solution. You […]
Angular.js share variables between controllers with service
Note: This article applies to Angular 1 and the example is written in ES5. Let’s say you have a directive where you have a button and once clicked you want an event to happen in another directive. The problem is that the two directives have different scopes, so passing the change directly is not possible. […]
Grails clean global mock on integration tests to avoid polluted environment
So, you are using Grails/Groovy for your app and Spock as testing framework. You have an integration test that is testing something on a class that has another dependencies that you have to mock. Something like: class TestedClassSpec extends Specification { @Unroll void “test some method on Class that has dependencies”() { given: def testedClass […]
Add https to Amazon S3 hosted website
First word: always make sure you understand the costs of using the following cloud services. In this tutorial, I’m going to show you how to add a certificate to a site hosted on Amazon S3 with a custom domain, so that your site will be accessed like https://your_site.something. For this article we’ll use ‘Let’s encrypt‘ […]