I'm having issues with using a simple directive inside the DocTypeGridEditor.
I'm adding the directive to the "umbraco.directives" module, but it never runs. Obviously the first "debugger" kicks in, but the link-function never fires. I initially thought it had something to due with the JS being lazy-loaded, but the issue persists even if I use "require.push".
Am I missing something or is it simply due to using the DocTypeGridEditor?
I believe it's because the preview markup is treated as a string, rather than in the DOM ... there may be a better "Angular way" to describe this? I'm not Angular expert - I usually leave that magic to Matt :-)
In the DTGE code, we get the preview markup from an API call, see code here... and render it out using ng-bind-html-unsafe, see code here.
The StackOverflow answers talk about using a compile directive - you could give that a try? (just to note it's not something I'm personally actively going to investigate - I've never had this need).
If it works out and you feel like sending a pull-request over to our GitHub repo, we're totally happy to review & discuss.
Thank your for the (very) quick and comprehensive response. It makes sense now that I see you're using ng-bind-html-unsafe.
I'll use a quick and simple solution for now and then look into using the $compile-service later in the project. If it's possible to make a decent implementation I'll definitely make a PR.
Using directives inside the grid editor
I'm having issues with using a simple directive inside the DocTypeGridEditor.
I'm adding the directive to the "umbraco.directives" module, but it never runs. Obviously the first "debugger" kicks in, but the link-function never fires. I initially thought it had something to due with the JS being lazy-loaded, but the issue persists even if I use "require.push".
Am I missing something or is it simply due to using the DocTypeGridEditor?
Hi Mathias,
I believe it's because the preview markup is treated as a string, rather than in the DOM ... there may be a better "Angular way" to describe this? I'm not Angular expert - I usually leave that magic to Matt :-)
I did a bit of googling around about this, and found this StackOverflow question... https://stackoverflow.com/q/17417607/12787
In the DTGE code, we get the preview markup from an API call, see code here... and render it out using
ng-bind-html-unsafe
, see code here.The StackOverflow answers talk about using a
compile
directive - you could give that a try? (just to note it's not something I'm personally actively going to investigate - I've never had this need).If it works out and you feel like sending a pull-request over to our GitHub repo, we're totally happy to review & discuss.
Cheers,
- Lee
Hi Lee,
Thank your for the (very) quick and comprehensive response. It makes sense now that I see you're using
ng-bind-html-unsafe
.I'll use a quick and simple solution for now and then look into using the
$compile
-service later in the project. If it's possible to make a decent implementation I'll definitely make a PR.is working on a reply...