Copied to clipboard

Flag this post as spam?

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


  • MB 108 posts 397 karma points
    Nov 16, 2018 @ 05:30
    MB
    0

    Plug-In - Angular Directives

    In wanting to use Angular directives, I've tried using using angular.module('umbraco', [directives]).controller(bla-bla-bla) but all I seem to manage to do is cause the backoffice to lockup and stop working.

    Are directives (such as Bootstrap pagination) supported, and if so, how?

  • Dan Diplo 1553 posts 6170 karma points MVP 4x c-trib
    Nov 16, 2018 @ 09:50
    Dan Diplo
    0

    If I understand you, you want to include a 3rd party Angular module and use it's directives?

    You can add a module using this syntax at the top of your controller:

    app.requires.push('module-name');
    

    For more context, read: https://our.umbraco.com/forum/umbraco-7/developing-umbraco-7-packages/47905-Including-an-angular-module

  • MB 108 posts 397 karma points
    Nov 16, 2018 @ 21:34
    MB
    0

    Thanks - I had seen and read that thread, but haven't had much luck with it.

    I was trying to add dirPagination as it's normally simple a table pagination directive to use.

    The standard use of this would be:

    1. load script
    2. add to your app:

    angular.module('myApp', ['angularUtils.directives.dirPagination']);

    I tried:

    1. add dirPagination.js to the manifest
    2. change the startup of the controller to be:

    var app = angular.module('umbraco'); app.requires.push('angularUtils.directives.dirPagination'); app.controller('myControllerName', myControllerReference);

    However, all I managed to do was cause the back-office to throw some script errors relating to an unexpected token < and an unknown module... causing the backoffice to stop working until I remove the offending lines.

  • Dave Woestenborghs 3430 posts 11699 karma points MVP 7x admin c-trib
    Nov 16, 2018 @ 10:10
    Dave Woestenborghs
    0

    Hi MB,

    If you just want pagination you can use the built-in directive : https://our.umbraco.com/apidocs/ui/#/api/umbraco.directives.directive:umbPagination

    Personally I have built a lot of backend customizations and I never had the need for a 3rd party plugin. I can do most things with the directives already available. And a bonus is when you use these directives everything will have the same look and feel of the rest of the backoffice.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft