'Failed to load template in angularjs

Inside angulajs 1x app I have following structure

  • app

    • common

      • js

        • directives

          notifications.js

        • templates

          notifications.html

    • security

notifications.js

(function(module) {    
    var notifications = function(notificating) {
        return {
            restrict: "AE",
            templateUrl: "templates/notifications.html",
// tried also   templateUrl: "../templates/notifications.html",
// tried also   templateUrl: "app/common/templates/notifications.html",
                link: function(scope) {
                // todo
            }
        };
    };    
    module.directive("notifications", notifications);
}(angular.module("common")));

inside firebug console I'm getting following error

angular.js:9658 XMLHttpRequest cannot load file:///G:/My%20App/app/templates/notifications.html. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.(anonymous function) @ angular.js:9658sendReq @ angular.js:9462serverRequest @ angular.js:9179processQueue @ angular.js:12914(anonymous function) @ angular.js:12930$eval @ angular.js:14123$digest @ angular.js:13939$apply @ angular.js:14227bootstrapApply @ angular.js:1487invoke @ angular.js:4152doBootstrap @ angular.js:1485bootstrap @ angular.js:1505angularInit @ angular.js:1399(anonymous function) @ angular.js:25579trigger @ angular.js:2742eventHandler @ angular.js:3013 angular.js:11358 Error: [$compile:tpload] Failed to load template: templates/templates.html http://errors.angularjs.org/1.3.0/$compile/tpload?p0=templates%2Ftemplates.html



Solution 1:[1]

If the directory structure you have given is correct below should work.

templateUrl: "common/js/templates/notifications.html",

Solution 2:[2]

You have to start the path from the index.html.

So "common/js/templates/notifications.html" should work.

Solution 3:[3]

When you use \acf you request a "full acronym", so you explicitly override what the package would normally do. If you use \af instead, you'll only get the footnote the first time.

As for "first time¨: the acronym package tracks whether it has spelled out the acronym already. You can reset this counter with \acresetall. This is independent of pages. In your example with the forced page break you could simply add \acresetall after \newpage. In larger documents you could add it to each \section or \chapter, or have it done automatically with the etoolbox package or look into this answer to hook it into a page break.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Muthukannan Kanniappan
Solution 2 Ian G
Solution 3