javascript - Is there a dynamic module loader for AngularJS that uses convention over configuration? -


The most dynamic modules I can find are not really dynamic and are actually lazy loaders because they are important That you want to register in the config files and registers.

I am looking for ways to use the Convention for a Loader JS and for my One Page App, loading anything under the folders.

Something like this:

  the app public loader.js & lt; - Anything manually modules module 1 controller controller controller1.js controller2.js instructions directive1.js directive2.js services service1.js service2.js view view1 no need to register Js view2.js    

Use caution here that you want to place loaders.js in your public folder. You only want to work with server side tools because you can not read your file system with the browser (without server side support). So you do not want to expose the loaders.js file to the public.

The thing about the module is that they help you to give some clarity to your application. Of course, you do not have to use it (angular way, though you want to support your app with unit test suite * see [below]). If you want to load everything you have, you do not have to define any module exactly (but one). But you can still benefit from the structure in your file system, Given that if you have all the controllers, then it is enough, the instructions and services are only for "your app" which is the only module defined by you:

  angular.module ('yourApp', []); // is defined within an // inline script tag at the top of your index.html   

+ (at the top of each of your controller / instructions / services):

  angular.module ('yourApp'). Controller (.....   

In this case, the work of the Kint-HTML-Build will be:

Of course, as the content is only a command line based work runner It will present a build step (meaning your app will not only serve the content of your folder in the web server) in your workflow. Every time you add a new file, The html-build function is to run again.

What do you do with content-HTML-Build? Specify a section in the header of your index.html, where the CUNT-HTML-Build lets you enter all the files specified in the configuration, such as:

  grunt.initConfig ({modulespath : "Module", htmlbuild: {dist: {src: 'index.html', dest: 'public /', option: {relative: true, script: {module: '  

Then put it on top of your head in your index.html (you have loaded an angle):

  & lt;! - build: script module - & gt; & Lt;! - / build - & gt;   

This is the part where module / will insert all your .js scripts below.

* The negative side of being the only one is a big module, that you will load and instantate many unnecessary services in your unit tests (i.e. whatever you inject into your app's run and config block). It increases the memory pants print of your test runner's browser and the test will also slow down.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -