asp.net mvc - Can you dynamically load modules in Angular? -
i have angular app 2 distinct sections it. each section belongs type of user. there commonalities part rather different. example:
/receptionist - view diary - answer phone - make tea /ceo - view diary - announce earnings - strategize
both ceo , receptionist need functionality viewing diary. thinking wanting change modules loaded (and routing) depending on logged in.
if (user.type === 'receptionist') { app = angular.module('receptionistapp', ['diary', 'phone', 'tea']); else { app = angular.module('ceoapp', ['diary', 'earning', 'strategy']); }
i wanting because there overlap, not lot. , each app quite big.
i not wanting achieve security wise here. each app have different types of users , roles. secured through webapi. wanting avoid loading of modules when 45% of them of no interest other app.
yes.
also, (and won't need this) can load modules even more dynamically, , initialize angularjs instead of having load instantly. can remove ng-app directive, , manual initialization.
angular.element(document).ready(function() { angular.module('myapp', []); angular.bootstrap(document, ['myapp']); });
Comments
Post a Comment