Thanks martin for the reply. I tried with the example shared by you.
However, I am still getting the same error.
I tried in both ngAfterViewInit & ngAfterViewChecked. Still getting the same error.
ERROR TypeError: Cannot read property ‘autoresizecolumns’ of undefined
at PreviewComponent.ngAfterViewInit (preview.component.ts:471)
at callProviderLifecycles (core.es5.js:11176)
at callElementProvidersLifecycles (core.es5.js:11147)
at callLifecycleHooksChildrenFirst (core.es5.js:11131)
at checkAndUpdateView (core.es5.js:12259)
at callViewAction (core.es5.js:12599)
at execEmbeddedViewsAction (core.es5.js:12557)
at checkAndUpdateView (core.es5.js:12252)
at callViewAction (core.es5.js:12599)
at execComponentViewsAction (core.es5.js:12531)
at checkAndUpdateView (core.es5.js:12257)
at callViewAction (core.es5.js:12599)
at execEmbeddedViewsAction (core.es5.js:12557)
at checkAndUpdateView (core.es5.js:12252)
at callViewAction (core.es5.js:12599)