Search code examples
angularjsangular-strap

404 not found angular-strap


I m getting this error when i try to use angular-strap's tooltip. Any ideas why its happening and how to solve it ?

GET http://localhost:3000/tooltip/tooltip.tpl.html 404 (Not Found)

My code looks like ;

var initTooltipAge = function () {
            // Tooltip Validation workaround https://github.com/mgcrea/angular-strap/issues/106
            var inputAge = document.getElementById('input-age');
            if (inputAge) {
                var tooltipAge = this.$tooltip(angular.element(inputAge), {
                    title: "blabla",
                    placement: 'top',
                    trigger: 'manual',
                    style: 'alert'
                });
            }

Solution

  • You forgot to load the template file:

    Load the required javascript libraries (Bootstrap scripts files are not needed).

    <script src="//cdnjs.cloudflare.com/ajax/libs/angular-strap/v2.3.7/angular-strap.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/angular-strap/v2.3.7/angular-strap.tpl.min.js"></script>
    

    Because the template file wasn't loaded, the templateCache is not fed so angularjs will try to fetch the resource, as configured in the directive:

    templateUrl: 'tooltip/tooltip.tpl.html',