Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with Angular2 ? #131

Closed
arunvelsriram opened this issue May 2, 2017 · 3 comments
Closed

How to use with Angular2 ? #131

arunvelsriram opened this issue May 2, 2017 · 3 comments

Comments

@arunvelsriram
Copy link

Hi. This is not an issue but a request to add examples of using StickyTableHeaders with Angular2.

Thanks.

@arunvelsriram
Copy link
Author

I was able to use it with Angular 2 via directive.

Here is the directive:

// sticky-table-header.directive.ts

import { Directive, ElementRef } from '@angular/core';

@Directive({
  selector: '[stickyTableHeader]'
})
export class StickyTableHeaderDirective {

  constructor(private el: ElementRef) {}

  ngAfterViewInit() {
    $(this.el.nativeElement).stickyTableHeaders();
  }

}

I use Angular CLI to manage my app. So I had to add the following to angular-cli.json:

"scripts": [
  "../node_modules/jquery/dist/jquery.js",
  "../node_modules/sticky-table-headers/js/jquery.stickytableheaders.js"
],

@ghost
Copy link

ghost commented Sep 6, 2018

Hi how do i use follwing with angular 5:
$('table').stickyTableHeaders({scrollableArea: $('.scrollable-area')});

@paulbonner
Copy link

paulbonner commented Oct 2, 2018

@arunvelsriram -- This is terrific, thanks!

@sushmit-oodles -- Pass the classname or the entire hash into the directive using an @input property. see https://angular.io/guide/attribute-directives

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants