This is what I have done.
I have app.js and app1.js. lob1 with dependencies is in app.js and lob2
with dependencies is in app1.js
it seems that since app.js and app1.js are both specified both their
dependencies are loaded. How can I fix this ?
bootstrap.js
define([
'require',
'angular',
'app',
'app1',
'router'
], function(require, angular) {
'use strict';
require(['requirejs-domready!'], function(document) {
if ( document.documentURI === 'uri1') {
angular.bootstrap(document, ['lob1']);
}else{
angular.bootstrap(document, ['lob2']);
}
});
});
Mohan
On Friday, 3 April 2015 16:06:02 UTC+5:30, Mohan Radhakrishnan wrote:
>
> Hi,
>
> I was atttempting to bootstrap module hierarchies based on the URI.
>
> bootstrap.js
>
> if ( document.documentURI === 'uri1') {
> angular.bootstrap(document, ['lob1']);
> }else{
> angular.bootstrap(document, ['lob2']);
> }
>
>
> This is what I tried. Can I do this ? I will load 'lob1' or lob2' based on a
> condition.
>
> If my app.js is not correct then I want to restructure it. How ?
>
>
> Moreover these two modules should only be associated like this.
>
> lob1 - > 'module1/moduleLoader1' (Load only when lob1 is bootstrapped )
>
>
> lob2 -> 'module2/moduleLoader2' (Load only when lob2 is bootstrapped )
>
>
> app.js
>
> define([
> 'framework-library',
> 'module1/moduleLoader1',
> 'module2/moduleLoader2',
> ], function(jquery, angular) {
> 'use strict';
> return angular.module('lob1', [
> 'ui.router',
> 'app.module1'
> ]);
> },function(jquery, jm, angular) {
> 'use strict';
> return angular.module('lob2', [
> 'ui.router',
> 'app.module2'
> ]);
> }
> );
>
> Thanks,
> Mohan
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.