Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mathias Rando Juul 2 posts 83 karma points
    Nov 06, 2017 @ 06:26
    Mathias Rando Juul
    0

    Using directives inside the grid editor

    I'm having issues with using a simple directive inside the DocTypeGridEditor.

    Code from the directive.

    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".

    Usage of the directive as an attribute.

    Am I missing something or is it simply due to using the DocTypeGridEditor?

    Including of the JS file inside the manifest.

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Nov 06, 2017 @ 11:15
    Lee Kelleher
    100

    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

  • Mathias Rando Juul 2 posts 83 karma points
    Nov 07, 2017 @ 08:16
    Mathias Rando Juul
    1

    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.

Please Sign in or register to post replies

Write your reply to:

Draft