Drag and drop in Angular

Overview 📄 Dragging and dropping has never been easier! Lets make use of the Component Development Kit (CDK) along with Angular 7+ to make some draggable divs in less than a minute! CDK setup ⚙️ Make sure you are on at least V7 of Angular. You can check this by running ng version from your chosen CLI (if you have the Angular CLI installed globally). Start by creating a new project....

February 1, 2019 · 1 min · Phil

Use of the :host selector

The :host selector can be used to target custom components from within a css environment. Let’s have a look! 👁️‍🗨️ Given you have a custom component such as; <album></album> In your css you may want to style the album element from within it’s inline stylesheet. This is where the :host selector comes in handy. Consider the below usage to add 10 pixels of margin to the album element. :host { margin: 10px; }

January 9, 2019 · 1 min · Phil

ng add

Overview 📄 The Angular CLI recently introduced a new command in version 6.0.0, ng add. At a glance, it looks like an alternative to npm install but let us take a look and see how the two approaches differ. Deeper look at ng add 👁️‍🗨️ In short, ng add will use your package manager to download the specified dependency, just as you would using npm install. Once downloaded the CLI will call an installation script which usually contains instructions on how to configure the project with the new dependency....

January 5, 2019 · 1 min · Phil