@mattfox you can lazy load an AngularJS module from your user module like this -
// userModule.js
define(['angular', 'require'], function(angular, require) {
'use strict';
const userModule = angular.module('userModule', ['maUiApp']);
userModule.config(['maUiMenuProvider', (maUiMenuProvider) => {
maUiMenuProvider.registerMenuItems([{
name: 'ui.myUserPage',
//name: 'myUserPage', <-- if you want no toolbar or menu
url: '/my-user-page',
// replace the xid below with the custom page xid
template: '<ma-ui-page-view xid="b35328af-4ceb-4e81-bf10-4eb282270524"></ma-ui-page-view>',
menuText: 'My user page',
menuHidden: false,
// set the user permission required to see the menu item
permission: 'user-permission-required',
resolve: {
loadMyDirectives: ['maRequireQ', '$injector', function(maRequireQ, $injector) {
// only loads the AngularJS module when navigating to this page
return maRequireQ(require, ['./restrictedModule.js'], function () {
$injector.loadNewModules(['restrictedModule']);
});
}]
}
}]);
}]);
return userModule;
});
Then create a separate module that is only loaded when the user navigates to that page -
//restrictedModule.js
define(['angular', 'require'], function(angular, require) {
'use strict';
const restrictedModule = angular.module('restrictedModule', []);
restrictedModule.component('myComponent', {
template: `
<span>Your username is {{$ctrl.name}}</span>
`,
// you can inject services into the controller
controller: ['maUser', function(maUser) {
this.name = maUser.current.username;
}]
});
});
Obviously this doesn't solve the need to store settings per user, I would recommend putting them in the JSON store for now. I personally can see the usefulness of storing arbitrary JSON data inside the user object, I can see if we can get it into a future release.