Using my own AngularJS Directives in Custom Dashboards
-
Hi,
I have previous experience using AngularJS and would like some of my work to be reused. How can I register an AngularJS directive for use in a custom dashboard?
Regards,
Gary
-
Hi @gary
Assuming you are using Mango v3, you can register a user AngularJS module from the UI settings page
/ui/administration/ui-settings
(its at the bottom)If you click the paper clip icon you can upload a JS file
Heres a sample user module JS file
define(['angular', 'require'], function(angular, require) { 'use strict'; var userModule = angular.module('userModule', ['maUiApp']) .directive('userHello', [function() { return { template: 'Hello, url is ' + require.toUrl('.') + ' {{$ctrl.testText}}', controller: angular.noop, controllerAs: '$ctrl', bindToController: { testText: '@' } } }]); return userModule; }); // define
-
Thank you, @Jared-Wiltshire. That's excellent, I shall give that a go.
-
@gary said in Using my own AngularJS Directives in Custom Dashboards:
Thank you, @Jared-Wiltshire. That's excellent, I shall give that a go.
I forgot to mention that the file uploader is a new feature, so make sure you update your Core and UI module.