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鈥檚 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鈥檚 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