Skip to content

Instantly share code, notes, and snippets.

@benfoley
benfoley / angular2 ViewChild ViewChildren.md
Created October 10, 2016 04:09
Angular2 ViewChild ViewChildren

Access DOM elements with Angular2's ViewChild and ViewChildren. I know it's not the preferred way, but sometimes handy.

Add a #label to the element in html.

Access that in the component by setting queries in the component decorator.

Then after the view is initialised we can get the nativeElement.

ViewChildren gives us a QueryList. The children aren't accessed directly through that, but we can filter/map/foreach that to get to the elements.

@benfoley
benfoley / set a bag limit of 1 for ionic2 rc0 dragula.md
Last active October 10, 2016 04:13
ionic2 rc0 dragula bag limit 1

Set up dragula as per the other gist.

When something is dropped, we clear the target's children and then re-append the dropped element.

Should do this more Angular-ey, but ok for now.

@benfoley
benfoley / install dragula for ionic2rc0.md
Last active October 10, 2016 03:41
Getting dragula to work with Ionic2 RC0

Getting dragula to work with Ionic2 RC0

Install Dragula

npm install dragula --save

Install Dragula typings

npm install @types/dragula --save
@benfoley
benfoley / Ionic2 Angular2 animations
Last active October 7, 2016 06:15
Ionic2 Angular2 animations
Start a new ionic 2 project
> https://ionicframework.com/docs/v2/cli/
```
ionic start animationTest --v2
```
Replace content in home files with below..
```
@benfoley
benfoley / Capistrano3 Unicorn Rbenv Ruby Nginx test app
Last active September 26, 2016 23:47
Config files for a Capistrano3 Unicorn Rbenv Ruby Nginx test app
Sample files for a basic Unicorn Capistrano3 setup - like something for DigitalOcean
Set up a user deploy, in new group deployers