my implementation for jQuery Wizard Steps with AngularJS + Typescripts
It should work well for other $compile
function too.
AppDirective.ts
export class stepwizard implements ng.IDirective {
constructor() {
console.log("construtor step wizard directive");
}
link($scope: ng.IScope, $element: JQuery, attributes: ng.IAttributes, ngModel: ng.INgModelController, ctrl: any) {
console.log("start step wizard link function");
$element.wrapInner('<div class="steps-wrapper">');
const steps = $element.children(".steps-wrapper").steps({
headerTag: "h3",
bodyTag: "section",
transitionEffect: "slideLeft",
autoFocus: true
});
const compiled = ctrl.$compile(steps);
}
public static Factory() {
var directive = () => {
return new stepwizard();
};
directive.$inject = ['$compile'];
console.log("initial step wizard");
return directive;
}
}
AppController.ts
export class pageController{
// your declaraction
static $inject: Array<string> = [
$compile',
];
constructor(
$compile: ng.ICompileService,
) {
// your constructor declaraction
}
HTML
// sample take from official website
<div stepwizard>
<h3>Keyboard</h3>
<section>
<p>Try the keyboard navigation by clicking arrow left or right!</p>
</section>
<h3>Effects</h3>
<section>
<p>Wonderful transition effects.</p>
</section>
<h3>Pager</h3>
<section>
<p>The next and previous buttons help you to navigate through your content.</p>
</section>
</div>
directives.stepwizard = <namespace>.directives.stepwizard.Factory();
app.directive(directives);