Tutorial by Examples

interface IMyDirectiveController { // specify exposed controller methods and properties here getUrl(): string; } class MyDirectiveController implements IMyDirectiveController { // Inner injections, per each directive public static $inject = ["$location", "...
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()); ...
For an easier transition to Angular 2, it's recommended to use Component, available since Angular 1.5.8 myModule.ts import { MyModuleComponent } from "./components/myModuleComponent"; import { MyModuleService } from "./services/MyModuleService"; angular .module("m...

Page 1 of 1