This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onDrop(src: Todo, trg: Todo) { | |
this._moveRow(src.order, trg.order); | |
} | |
_moveRow(src, trg) { | |
src = parseInt(src); | |
trg = parseInt(trg); | |
// If the element was moved down | |
if (src > trg) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul> | |
<todo *ngFor=”let todo of todos” [todo]=”todo” [makeDraggable]=”todo” makeDroppable (dropped)=”onDrop($event, todo)”></todo> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
selector: '[makeDroppable]' | |
}) | |
export class MakeDroppable implements OnInit { | |
@Output() dropped: EventEmitter<any> = new EventEmitter(); | |
constructor(private _elementRef: ElementRef) {} | |
ngOnInit() { | |
let el = this._elementRef.nativeElement; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
selector: '[makeDraggable]' | |
}) | |
export class MakeDraggable { | |
@Input('makeDraggable') data: any; | |
constructor(private _elementRef: ElementRef) {} | |
ngOnInit() { | |
// Get the current element |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ng2 new ng2_dnd | |
ng2 serve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'), | |
app = express(), | |
bodyParser = require('body-parser'), | |
cookieParser = require('cookie-parser'), | |
session = require('express-session'), | |
passport = require('passport'), | |
wsfedsaml2 = require('passport-wsfed-saml2').Strategy; | |
passport.use('wsfed-saml2', new wsfedsaml2({ | |
realm: 'urn:node:app', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
binaries=( | |
node | |
git | |
) | |
echo "installing binaries..." | |
brew install ${binaries[@]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#new branch | |
git checkout -b <branchname> | |
#switch back to master | |
git checkout master |