Knowing when the Umbraco Backoffice has finished creating all properties and loaded data
Hi,
Is there anyway from an angular controller to know when all the divs and content have been loaded in the back office?
I have a custom property editor that's being used in an Archetype data type and the controller fires before the Archetype instance has been created it seems (as the divs I try and target don't exist when the controller fires)... how can I know Umbraco / Archetype has finished loading before running custom code - is there an event that's fired?
At the moment I have used a stinky setTimeout but this is destined to fail.
Use the angular $timeout functionality - but without a delay (set it to zero).. this adds it to the "queue" and will only fire when Archetype et al have finished creating the new instance.
You need to pass $timeout to your Controller:
angular.module("umbraco")
.controller("My.FileUploadProgress",
function ($scope, $timeout) {
Then just call your function via a timeout (note how a var is used and a function - otherwise the params are passed immediately not at timeout):
Knowing when the Umbraco Backoffice has finished creating all properties and loaded data
Hi,
Is there anyway from an angular controller to know when all the divs and content have been loaded in the back office?
I have a custom property editor that's being used in an Archetype data type and the controller fires before the Archetype instance has been created it seems (as the divs I try and target don't exist when the controller fires)... how can I know Umbraco / Archetype has finished loading before running custom code - is there an event that's fired?
At the moment I have used a stinky setTimeout but this is destined to fail.
Kind regards
Steve
I've solved this... credit to http://blog.brunoscopelliti.com/run-a-directive-after-the-dom-has-finished-rendering/
Use the angular $timeout functionality - but without a delay (set it to zero).. this adds it to the "queue" and will only fire when Archetype et al have finished creating the new instance.
You need to pass $timeout to your Controller:
Then just call your function via a timeout (note how a var is used and a function - otherwise the params are passed immediately not at timeout):
or wrap your controller code in one:
Hope this helps someone in the future!
Steve
is working on a reply...