Skip to main content

Posts

Showing posts from 2018

Difference between ng-template, ng-content and ng-container

While working on a very complex feature for a client in which I had to present hierarchical dynamic data in three column layout with ability to expand like google image search on each level, I came across ng-content, which seemed like a perfect fit for the solution I was thinking about implementing. But I got confused between ng-content and ng-container when I saw the generated html while debugging my code in developer console. I further investigated both ng-content and ng-container and decided to write my finding here in my blog for future references. If you are also wondering what are they for, read on. <ng-container> When you have to write different host elements to combine many structural component like the following <div *ngIf="condition"> <div *ngFor="..."> Some content here </div> </div> You get many unintentional host elements which are not required for your layout. It becomes a prolem when you have complex appl

Using AWS Cloud9 and AWS CodeCommit to create Angular project.

Assuming you already know what is AWS Cloud9 and are already familier with Angular and Angular Cli, I will jump straight to the steps to create and serve an Angular 7 project right from the Cloud9 IDE. To reach to the welcome page of IDE, perform following steps. Target 1: Create your repository and environment. Login to your AWS console using your root credentials. Go to IAM and create a new user so that you can use it for AWS CodeCommit and AWS Cloud9. This is highly discouraged to use your root account for all of these purposes. Make sure to either generate password for your newly created account of configure SSH access for the account. Go to AWS CodeCommit console and create a new repository and enter repository name and description and click on next. You will be redirected to the repositories list page where you will  find your newly created repostiory. Now open AWS Cloud9 console  and create a new environment. Enter environment name and description and click on nex

Getting started with Terraform

What is Terraform Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently using code written in configuration files. It creates an execution plan before actually executing it and also maintains a resource graph and versions the current state of the infrastructure and applies only the changes when you run it again after making changes in the configuration files. Terraform code is written in a declarative language called HCL (HashiCorp Configuration Language). The HCL code goes into files with extension .tf. So far terraform doesn't support arrangemnet of code into folders. So all your .ts files go directly in the root level folder. The general syntax of terraform resource is: resource "PROVIDER_TYPE" "NAME" { [CONFIG ...] } We will discuss later, what is a resource and what this syntax mean. Here I have added it to demonstrate that how declarative the language is. Which cloud It supports multiple cloud provide