Skip to content

Instantly share code, notes, and snippets.

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) {
<ul>
 <todo *ngFor=”let todo of todos” [todo]=”todo” [makeDraggable]=”todo” makeDroppable (dropped)=”onDrop($event, todo)”></todo>
</ul>
@Directive({
selector: '[makeDroppable]'
})
export class MakeDroppable implements OnInit {
@Output() dropped: EventEmitter<any> = new EventEmitter();
constructor(private _elementRef: ElementRef) {}
ngOnInit() {
let el = this._elementRef.nativeElement;
@Directive({
selector: '[makeDraggable]'
})
export class MakeDraggable {
@Input('makeDraggable') data: any;
constructor(private _elementRef: ElementRef) {}
ngOnInit() {
// Get the current element
ng2 new ng2_dnd
ng2 serve
@mithun-daa
mithun-daa / server.js
Created February 20, 2015 18:01
Authenticating a Node application using Thinktecture Identity Server v2
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',
@mithun-daa
mithun-daa / gist:170822fe46116879d9f9
Created February 1, 2015 03:52
Install brew binaries
binaries=(
node
git
)
echo "installing binaries..."
brew install ${binaries[@]}
@mithun-daa
mithun-daa / branches
Created December 19, 2011 18:22
Commited new/updated files to git
#new branch
git checkout -b <branchname>
#switch back to master
git checkout master