To achieve this behavior, I've created an attribute directive that can be attached to any component. It has 2 attributes:
- The "loading" flag that should be set to true while data is loafing and false once data is loaded. This attribute is mandatory.
- An optional loading message that replaces the default "Loading..." message.
Note: Since the "loading" directive needs to cover the entire component, its css layout is set to "absolute". That means that the DIV element the directive is attached to must have its layout set to "relative".
See the demo below. The code can be viewed on Github.
See the demo below. The code can be viewed on Github.