Angular 2 - how to access directive and call a member function in it

Viewed 20031

I have a directive like this -

@Directive({
    selector:   'someDirective'
})
export class  SomeDirective{         
    constructor() {}    
    render = function() {}
}

and then I am importing the directive

import {SomeDirective} from '../../someDirective';
@Page({
    templateUrl: '....tem.html',
    directives: [SomeDirective]
})
export class SomeComponent {
      constructor(){}
      ngAfterViewInit(){//want to call the render function in the directive
}

In ngAfterViewInit, I want to call the render function in the directive. How to do this ?

1 Answers
Related