Skip to content

Instantly share code, notes, and snippets.

@basarat
Created January 16, 2015 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save basarat/00e580b1fae842016941 to your computer and use it in GitHub Desktop.
Save basarat/00e580b1fae842016941 to your computer and use it in GitHub Desktop.
sample directive
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