Example
export function myDirective($location: ng.ILocationService): ng.IDirective {
return {
link: (scope: ng.IScope,
element: ng.IAugmentedJQuery,
attributes: ng.IAttributes): void => {
element.text("Current URL: " + $location.url());
},
replace: true,
require: "ngModel",
restrict: "A",
templateUrl: templatesUrl.myDirective,
};
}
// Using slug naming across the projects simplifies change of the directive name
myDirective.prototype.slug = "myDirective";
// You can place this in some bootstrap file, or have them at the same file
angular.module("myApp").
directive(myDirective.prototype.slug, [
Templates.prototype.slug,
myDirective
]);