Created
January 16, 2015 17:40
-
-
Save basarat/00e580b1fae842016941 to your computer and use it in GitHub Desktop.
sample directive
This file contains 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
export class FooDirectiveController { | |
static $inject = ['$element', '$scope']; | |
constructor(public $element: JQuery, public $scope: FooDirectiveScope) { | |
$scope.vm = this; | |
// Any Jquery access goes here. Use $element | |
// Setup any $watch on $scope that you need | |
} | |
} | |
export interface FooDirectiveScope extends ng.IScope { | |
bar: string; | |
// Local design only | |
vm: FooDirectiveController; | |
} | |
dustApp.directives.directive('foo', function (): ng.IDirective { | |
return { | |
restrict: 'E', | |
scope: { | |
// NOTE : see documentation in type information | |
bar: '=' | |
}, | |
templateUrl: 'fooDirective.html', | |
controller: FooDirectiveController | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment