Error using.js numeral in Asp.Net MVC application

Asked

Viewed 156 times

0

I am trying to convert the table data to the correct monetary value, and I am using the numeral.js, I have the following script

@section scripts{

    <script src="~/Scripts/jquery.bootgrid.js"></script>
    <script src="~/Scripts/numeral/numeral.min.js"></script>

    @Scripts.Render("~/bundles/jquerybootgrid")
    <script src="~/Scripts/Projeto/ControlarGrid.js"></script>

    <script type="text/javascript">        

        numeral.language("pt-br");

        var controller = "Produtos";
        var urlListar = "@Url.Action("Listar")";
        $(document).ready(configurarControles);
    </script>
}

where I have a script folder ... and a language with the en to use as default, but when it starts the script an error occurs right in the numeral.language("pt-br") taking into consideration that I am calling the file numeral.min.js

  • What error appears? Open the browser console and analyze the error there.

  • The following error occurs Failed to load Resource: the server responded with a status of 404 (Not Found) Products:315 Uncaught Typeerror: numeral.Languages is not a Function at Products:315 ... but this is provided by the ... number because if I take it out, it works normally

  • Failed to load JS file from Numeral, hence variable numeral does not have the function language. Make sure you are loading the right script on the page.

  • Well when I go in source by browser, appears the folder numeral and inside is only appearing the numeral.min.js the other files are not being loaded and neither the language

  • Where is the HTML reference of the "language" file? From what I understand, the function language is already from the file "numeral.min.js".

  • But I have to also make a call to the language inside this html? so I can use the numeral.language?

  • <script src="~/Scripts/numeral/Languages.min.js"></script> <script src="~/Scripts/numeral/Languages/en.js"></script> Should I also make these calls? and even if I do that the error continues to persist ...

  • If you need to use "Languages.min.js", of course you have to import it into the HTML page. Now the function error numeral.language may be attached to these two scripts, so put the reference of the two on the page and test again.

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.