I have the following:
main.module.ts
//Importing "my_section"
...
import { my_section } from './my_section';
@NgModule({
declarations: [...],
imports: [..., my_section],
exports: [...]
})
export class main_pageModule {}
main.html
//As an example, let say I have three "my_section"
<div class="top">
<my_section></my_section>
<my_section></my_section>
<my_section></my_section>
</div>
Then,
my_section.ts
...
@Component({
selector: 'my_section',
templateUrl: 'my_section.html'
})
export class my_section{
...
}
This is a simplified version of it: As you can see, <my_section></my_section>
is imported from my_section.ts
into main.module.ts
.
I am trying to trigger a function when each <my_section></my_section>
is in view.
I tried to use ViewChild
, but no luck.
Any idea how I can detect when a custom element is in view?
Thanks!