Created
July 20, 2015 13:26
-
-
Save Mati365/bd33f2f5bd5e2997198d to your computer and use it in GitHub Desktop.
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 module Directives { | |
interface ITabsScope extends ng.IScope { | |
repeat: string; | |
pages: number; | |
} | |
export class Tabs implements ng.IDirective { | |
public priority: number = 5000; | |
public terminal: boolean = true; | |
public scope = { | |
repeat: '@appTabs' | |
, pages: '@appTabsLimit' | |
}; | |
constructor(private $compile: ng.ICompileService) { | |
//(<any>Tabs.prototype).compile = (element: ng.IAugmentedJQuery, attr: ng.IAttributes) => { | |
// attr.$set('ngRepeat', (<any> attr).appTabs); | |
// let compiled = this.$compile(element, null, 5000); | |
// return scope => { | |
// compiled(scope); | |
// }; | |
//}; | |
} | |
public compile(element: ng.IAugmentedJQuery, attr: ng.IAttributes) { | |
attr.$set('ngRepeat', (<any> attr).appTabs); | |
let compiled = this.$compile(element, null, 5000); | |
return scope => { | |
compiled(scope); | |
}; | |
} | |
static factory(): ng.IDirectiveFactory { | |
return $compile => new Tabs($compile); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment