javascript - Angular + Requirejs - how to return multiple modules? -


How can I return several angle modules in the requirejs environment?

Define this my app.js, <, ("harsh use"; console.log ($ ('h1') (['angle', 'angular path', 'jquery' ], Function (ng, ngrut, $) length); return ng module ('myApp', ['ngRoute']);});

And I need some more modules to come back,

  ng.module ('myAppModule1', ['ngRoute']); Ng.module ('myAppModule2', ['NGRUT']]; Ng.module ('myAppModule3', ['ngRoute']); For example, define an example of a controller  app.js , 

  define (['app'], function (app) {var myAppModule = angular.module ( 'MyAppModule3'); myAppModule.controller ('welcomecountry', ['$ scope', function ($ radius) {// your missoff controller $ scope.message = "message from the WelcomeController";}]));});  

You app.js to return an item Define ('[angle'] 'angular', 'jquery'], function (ng, ngrut, $) {'strict use' '; Console return ($ (' H1 ') length); return {myApp: ng.module (' myApp ', [' ngRoute ']), myAppModule1: ng.module (' myAppModule1 ', [' ngRoute ']) , MyAppModule2: Ng.module ('myAppModule2', ['ngRoute']), myAppModule3: ng.module ('myAppModule3', ['ngRoute'])}}});

And change your controller like this:

  Define (['app'], function (app) {app.myAppModule3.controller ('WelcomeControler ', [' $ Scope ', function ($ scope) {// your missoff controller $ scope.message = "message from the WelcomeController"}})));});  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -