Skip to content

Instantly share code, notes, and snippets.

@Mati365
Created July 20, 2015 13:26
Show Gist options
  • Save Mati365/bd33f2f5bd5e2997198d to your computer and use it in GitHub Desktop.
Save Mati365/bd33f2f5bd5e2997198d to your computer and use it in GitHub Desktop.
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