Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Directive: when templateUrl is a nonexistent url then the whole app is loded instead of the template #10965

@jrencz

Description

@jrencz

I just had the followin experience:
I have created an element directive like this:

(function () {
    'use strict';

    angular
        .module('myDirective', [])

        .directive('myDirective', function () {
            return {
                restrict: 'E',
                templateUrl: '/templates/my-directive',
            };
        });
})();

And I misped the temlateUrl. There should be .html at the end off course.
The strange thing that happened was that my whole application was loaded ad many times as this directive was used

I off course had WARNING: Tried to load angular more than once. and Uncaught Error: [ng:btstrpd] App Already Bootstrapped with this Element '<html class="ng-scope" lang="en-US" dir="ltr">' but I don't find this particular behaviour very intuitive. There might have been a better solution for handling nonexistent templates. Or at least I'd expect for angular NOT to load the app again.

Environment details:
angular 1.3.11
templateCache is on

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions