src/services/$Response.js
function controllerTemplateRouteResponse() {
    if (this.template) {
        let match = this.template.toString().match(/!doctype ([a-z]+)/i),
            mime;

        // In the context where MIME type is not set, but we have a
        // DOCTYPE tag, we can force set the MIME
        // We want this here instead of the explicit template definition
        // in case the MIME failed earlier
        if (match && !this.response.$headers.hasOwnProperty('Content-Type')) {
            mime = this.response.$headers[ 'Content-Type' ] =
                $MimeType.$$(match[1].toLowerCase());
        }

        // Check to see if this is an HTML template and has a DOCTYPE
        // and that the proper configuration options are set
        if (
            mime === 'text/html' &&
            config.loadDefaultScriptFile &&
            (
                this.route.hasOwnProperty('useDefaultScriptFile') ||
                this.route.useDefaultScriptFile !== false
            )
        ) {

            // Check that option is not true
            let scriptFile = config.loadDefaultScriptFile === true ?
                'application.js' : config.loadDefaultScriptFile;
            $resourceLoader(scriptFile);
        }

        // Pull the response back in from wherever it was before
        this.content = this.response.content;

        // Render the template into the resoponse
        let me = this;
        return new Promise(function(resolve) {

            // $Compile to parse template strings and app.directives
            return $compile(me.template)(

                // In the context of the scope
                me.$scope
            ).then(function(template) {
                resolve(template);
            });
        }).then(function(template) {
            me.response.content = me.content += template;
            me.response.write(me.content);
        });
    }
}
function controllerTemplateRouteResponse() {
    if (this.template) {
        let match = this.template.toString().match(/!doctype ([a-z]+)/i),
            mime;

        // In the context where MIME type is not set, but we have a
        // DOCTYPE tag, we can force set the MIME
        // We want this here instead of the explicit template definition
        // in case the MIME failed earlier
        if (match && !this.response.$headers.hasOwnProperty('Content-Type')) {
            mime = this.response.$headers[ 'Content-Type' ] =
                $MimeType.$$(match[1].toLowerCase());
        }

        // Check to see if this is an HTML template and has a DOCTYPE
        // and that the proper configuration options are set
        if (
            mime === 'text/html' &&
            config.loadDefaultScriptFile &&
            (
                this.route.hasOwnProperty('useDefaultScriptFile') ||
                this.route.useDefaultScriptFile !== false
            )
        ) {

            // Check that option is not true
            let scriptFile = config.loadDefaultScriptFile === true ?
                'application.js' : config.loadDefaultScriptFile;
            $resourceLoader(scriptFile);
        }

        // Pull the response back in from wherever it was before
        this.content = this.response.content;

        // Render the template into the resoponse
        let me = this;
        return new Promise(function(resolve) {

            // $Compile to parse template strings and app.directives
            return $compile(me.template)(

                // In the context of the scope
                me.$scope
            ).then(function(template) {
                resolve(template);
            });
        }).then(function(template) {
            me.response.content = me.content += template;
            me.response.write(me.content);
        });
    }
}
function controllerTemplateRouteResponse ( ) { if ( this . template ) { let match = this . template . toString ( ) . match ( / !doctype ([a-z]+) / i ) , mime ; // In the context where MIME type is not set, but we have a // DOCTYPE tag, we can force set the MIME // We want this here instead of the explicit template definition // in case the MIME failed earlier if ( match && ! this . response . $headers . hasOwnProperty ( 'Content-Type' ) ) { mime = this . response . $headers [ 'Content-Type' ] = $MimeType . $$ ( match [ 1 ] . toLowerCase ( ) ) ; } // Check to see if this is an HTML template and has a DOCTYPE // and that the proper configuration options are set if ( mime === 'text/html' && config . loadDefaultScriptFile && ( this . route . hasOwnProperty ( 'useDefaultScriptFile' ) || this . route . useDefaultScriptFile !== false ) ) { // Check that option is not true let scriptFile = config . loadDefaultScriptFile === true ? 'application.js' : config . loadDefaultScriptFile ; $resourceLoader ( scriptFile ) ; } // Pull the response back in from wherever it was before this . content = this . response . content ; // Render the template into the resoponse let me = this ; return new Promise ( function ( resolve ) { // $Compile to parse template strings and app.directives return $compile ( me . template ) ( // In the context of the scope me . $scope ) . then ( function ( template ) { resolve ( template ) ; } ) ; } ) . then ( function ( template ) { me . response . content = me . content += template ; me . response . write ( me . content ) ; } ) ; } }
Performs the templating inside of Controller Classes
Performs the templating inside of Controller Classes