Search Posts

Is it possible to take a giant string and load it through a URL path as JavaScript?

how to Is it possible to take a giant string and load it through a URL path as JavaScript?

I’m trying to make it easy to have an infinitely large single paged AngularJS web application by using OCLazyLoad to only load pages that are requested by the user. And I’d like to load HTML, JS and CSS lazily through a WebSocket rather than HTTP.

The reason why I want WebSockets is because all web browsers do not enforce any kind of CORs on domain names so that scaling could be done like:




I’d like to have this kind of scaling because it could potentially already help with peer to peer file transfers between one browser to another by streaming files in raw Base64 chunks.

There’s also the advantage of using raspberry pis running ubuntu as cheap but powerful worker drones.

But before I get around to those experimental features, It’d be cool to load a string into OCLazyLoad. But if you look at my Controller.js, OCLazyLoad can only load JS from a URL:


(function() {
    'use strict';
    angular.module('app.FUSE_APP_NAME', ['flow']).config(config);

    function config($stateProvider, $translatePartialLoaderProvider, msApiProvider, msNavigationServiceProvider) {
            .state('app.FUSE_APP_NAME', {
                url: '/FUSE_APP_NAME',
                views: {
                    '[email protected]': {
                        templateUrl: '/krogoth_gantry/DynamicHTMLInjector/?name=FUSE_APP_NAME',
                        controller: 'FUSE_APP_NAMEController as vm'
        _DJANGULAR_SLAVE_VC_INJECTION_POINT_; /* krogoth_gantry Slave VCs automatically injected here. */
        msNavigationServiceProvider.saveItem('AK_NAVCAT_KROGOTH.AK_SUBCATAGORY_KROGOTH.FUSE_APP_NAME', {
            title: 'FUSE_APP_TITLE',
            icon: 'FUSE_APP_ICON',
            state: 'app.FUSE_APP_NAME',
            weight: 3


(function() {
    'use strict';
    angular.module('app.FUSE_APP_NAME').controller('FUSE_APP_NAMEController', FUSE_APP_NAMEController);

    function FUSE_APP_NAMEController($log, $state, $ocLazyLoad) {
        var vm = this;
        vm.$onInit = onInit;
        vm.viewName = 'FUSE_APP_NAME';
        vm.viewDidLoad = viewDidLoad;

        vm.initLazyModule = initLazyModule;
        vm.stateGoToLazy = stateGoToLazy;

        function onInit() {
            console.log('FUSE_APP_NAME did finish loading');

        function viewDidLoad() {

        function btnClickInitLazyModule() {

        function stateGoToLazy() {

// Name:

// We will load: LAZYMVC_UNLOADED



OCLazyLoad seems to require a URL for loading additional AngularJS modules, is there a way to simple load a raw string as if it were the path to a JS or HTML file?

My DynamicHTMLInjector and DynamicJavaScriptInjector don’t point to file system paths, I’m simply tricking the JavaScript to assuming that it’s loading static files.

Source: AngularJS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.