docs/app/js/demoInclude.js
function handleDemoIndexFile() {
      files.index.contentsPromise.then(function(contents) {
        demoContainer = angular.element(
          '<div class="demo-content ' + ngModule + '">'
        );

        var isStandalone = !!ngModule;
        var demoScope;
        var demoCompileService;
        if (isStandalone) {
          angular.bootstrap(demoContainer[0], [ngModule]);
          demoScope = demoContainer.scope();
          demoCompileService = demoContainer.injector().get('$compile');
          scope.$on('$destroy', function() {
            demoScope.$destroy();
          });

        } else {
          demoScope = scope.$new();
          demoCompileService = $compile;
        }

        // Once everything is loaded, put the demo into the DOM
        $q.all([
          handleDemoStyles(),
          handleDemoTemplates()
        ]).finally(function() {
          demoScope.$evalAsync(function() {
            element.append(demoContainer);
            demoContainer.html(contents);
            demoCompileService(demoContainer.contents())(demoScope);
          });
        });
      });

    }
function handleDemoIndexFile() {
      files.index.contentsPromise.then(function(contents) {
        demoContainer = angular.element(
          '<div class="demo-content ' + ngModule + '">'
        );

        var isStandalone = !!ngModule;
        var demoScope;
        var demoCompileService;
        if (isStandalone) {
          angular.bootstrap(demoContainer[0], [ngModule]);
          demoScope = demoContainer.scope();
          demoCompileService = demoContainer.injector().get('$compile');
          scope.$on('$destroy', function() {
            demoScope.$destroy();
          });

        } else {
          demoScope = scope.$new();
          demoCompileService = $compile;
        }

        // Once everything is loaded, put the demo into the DOM
        $q.all([
          handleDemoStyles(),
          handleDemoTemplates()
        ]).finally(function() {
          demoScope.$evalAsync(function() {
            element.append(demoContainer);
            demoContainer.html(contents);
            demoCompileService(demoContainer.contents())(demoScope);
          });
        });
      });

    }
function handleDemoIndexFile ( ) { files . index . contentsPromise . then ( function ( contents ) { demoContainer = angular . element ( '<div class="demo-content ' + ngModule + '">' ) ; var isStandalone = ! ! ngModule ; var demoScope ; var demoCompileService ; if ( isStandalone ) { angular . bootstrap ( demoContainer [ 0 ] , [ ngModule ] ) ; demoScope = demoContainer . scope ( ) ; demoCompileService = demoContainer . injector ( ) . get ( '$compile' ) ; scope . $on ( '$destroy' , function ( ) { demoScope . $destroy ( ) ; } ) ; } else { demoScope = scope . $new ( ) ; demoCompileService = $compile ; } // Once everything is loaded, put the demo into the DOM $q . all ( [ handleDemoStyles ( ) , handleDemoTemplates ( ) ] ) . finally ( function ( ) { demoScope . $evalAsync ( function ( ) { element . append ( demoContainer ) ; demoContainer . html ( contents ) ; demoCompileService ( demoContainer . contents ( ) ) ( demoScope ) ; } ) ; } ) ; } ) ; }
Fetch the index file, and if it contains its own ngModule
then bootstrap a new angular app with that ngModule. Otherwise, compile
the demo into the current ng-app.
Fetch the index file and if it contains its own ngModule then bootstrap a new angular app with that ngModule . Otherwise compile the demo into the current ng - app .