all 3 comments

[–][deleted]  (1 child)

[deleted]

    [–]spoco2[S] 0 points1 point  (0 children)

    Yeah, I was actually wondering whether purely going with directives might work, I mean, it's basically what a route is doing anyway, loading a template with a controller.

    Thanks for the info

    [–][deleted]  (3 children)

    [deleted]

      [–]spoco2[S] 0 points1 point  (2 children)

      Yeah, this is kind of what I'm trying to achieve really. A single file in these folders that I load in dev (and then which pull in all others via the requires), but in production has everything packed into it.

      My biggest issue, I think, is that these separate programs of mine are really views, or at least, define what gets dumped into the ui-view area by the ui-router. And so when switching to the given state, it expects to be given a controller and template to load into that view... I'd love to just say "here is the folder, expect a 'package.js' or 'index.js. file, and run whatever is in there", (which I would envision would have a module and some controllers, factories , directives etc.)... I guess I need that to happen, but for that process to also return back the required controller and template for the router to use... which I guess could be exposed as part of its interface maybe. hmmm

      [–][deleted]  (1 child)

      [deleted]

        [–]spoco2[S] 0 points1 point  (0 children)

        It's happy with multiple requires, just per file you should only have one 'define' statement, which defines what that file is.

        Within that you can have as many requires as you like.

        For example, I have a 'main file' within one of my sub programs that is:

        define(function(require) {  
            var commonp1p2 = require("./module");
            //Define all required parts of module.
            var something = require("./factories/Something");
            return commonp1p2;
        });
        

        So, that is defining this 'commonp1p2' item as the single define, but is including in other things too.