Copied to clipboard

Flag this post as spam?

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


  • Pierre Luypaert 5 posts 85 karma points
    Jul 12, 2018 @ 21:30
    Pierre Luypaert
    0

    Macro with Angular controller in a grid editor

    Hi,

    How can I implement a macro with Angular code in it that would run correctly in the grid layout editor?

    My Angular controller doesn't get executed. It's not a plugin so there is no manifest to register it.

    Thanks

    Pierre

  • Alex Brown 129 posts 620 karma points
    Jul 13, 2018 @ 07:18
    Alex Brown
    100

    Just out of curiosity, why are you trying to execute Angular in a macro? They're design to provide dynamic content to users on the client-side.

    Can you not just create a plugin instead and reference the cshtml file in the "render" property of the package.manifest?

    An long tedious guide can be found here

    https://abrowndev.co.uk/blog/creating-a-custom-grid-editor/

  • Pierre Luypaert 5 posts 85 karma points
    Jul 13, 2018 @ 07:29
    Pierre Luypaert
    0

    The goal is to make custom complex forms (or other complex front end components) available in a grid layout. Since Umbraco uses Angular for its backend, I figured it would be simpler to use an Angular controller.

  • Alex Brown 129 posts 620 karma points
    Jul 13, 2018 @ 07:40
    Alex Brown
    0

    Sorry to go on about plugins but it's not too bad creating them when you've done it once. I create property editors for the grid frequently, such as carousels or Javascript wheels.

    You can create forms in plugins and then easily attach them to the grid.

  • Pierre Luypaert 5 posts 85 karma points
    Jul 13, 2018 @ 15:18
    Pierre Luypaert
    0

    I gave it a try. The "render" view (cshtml) is not executed automatically in the backend. I need to implement and call something similar to GetMacroResultAsHtmlForEditor.

    In the end the editor and the rendering are still completely separate. There is no benefit in using Angular to render the cshtml.

Please Sign in or register to post replies

Write your reply to:

Draft