Html frontend tips and tricks

Issue: How do I know when the UI is created so that my script may expect to find named things in Components?

Solution: Normally you can hook DocumentReady - but since the UI is dynamic - it will load async. A better way is to have a angular directive - and once angular is resolving this you are sure everything is in place.

Example: I know that there will be data in my viewmodel column named "Channels" - put a directive-label in the loop like this:

2019-02-10 16h41 36.png

In JS I will then instruct Angular to handle this directive:

2019-02-10 16h44 55.png

In 1 I register the Directive with our AppModule, by sending in the name "channel"(2), once angular creates a row having this directive it will call link and we end up in 3 - here we check that it is the first time we are here and do our init that requires that other elements are available.

This page was edited 148 days ago on 12/20/2023. What links here