Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular 4 deployment into asp.net website giving error

I have succesfully built and deployed my angular component into asp.net website. But the problem is if I paste my code under body tag it works fine. But if I paste inside a form it doesn't work.

So this works fine in main.master:

<body>
  <app-root>testtt</app-root>
  <script type="text/javascript" src="/scripts/inline.bundle.js"></script>
  <script type="text/javascript" src="/scripts/polyfills.bundle.js"></script>
  <script type="text/javascript" src="/styles.bundle.js"></script>
  <script type="text/javascript" src="/scripts/vendor.bundle.js"></script>
  <script type="text/javascript" src="/scripts/main.bundle.js"></script>

But if I copy this code into another webpage which using this master page, it doesn't work and I see following logs in console.

Uncaught Error: Sys.ParameterCountException: Parameter count mismatch.
    at Function.Error$create [as create] (ScriptResource.axd?d=3YJmGXxjI2IKNjUZL30bBbVBGOzpviJQaJ0A9mxA_CXR8fTNHpjVjDF4vyz3OkxXRfN4mDos_e1vdt…:237)
    at Function.Error$parameterCount [as parameterCount] (ScriptResource.axd?d=3YJmGXxjI2IKNjUZL30bBbVBGOzpviJQaJ0A9mxA_CXR8fTNHpjVjDF4vyz3OkxXRfN4mDos_e1vdt…:413)
    at Function$_validateParameterCount [as _validateParameterCount] (ScriptResource.axd?d=3YJmGXxjI2IKNjUZL30bBbVBGOzpviJQaJ0A9mxA_CXR8fTNHpjVjDF4vyz3OkxXRfN4mDos_e1vdt…:118)
    at Function$_validateParams [as _validateParams] (ScriptResource.axd?d=3YJmGXxjI2IKNjUZL30bBbVBGOzpviJQaJ0A9mxA_CXR8fTNHpjVjDF4vyz3OkxXRfN4mDos_e1vdt…:70)
    at String$startsWith (ScriptResource.axd?d=3YJmGXxjI2IKNjUZL30bBbVBGOzpviJQaJ0A9mxA_CXR8fTNHpjVjDF4vyz3OkxXRfN4mDos_e1vdt…:491)
    at String.startsWith (polyfills.bundle.js:5199)
    at new Sys$UI$DomEvent (ScriptResource.axd?d=3YJmGXxjI2IKNjUZL30bBbVBGOzpviJQaJ0A9mxA_CXR8fTNHpjVjDF4vyz3OkxXRfN4mDos_e1vdt…:3986)
    at browserHandler (ScriptResource.axd?d=3YJmGXxjI2IKNjUZL30bBbVBGOzpviJQaJ0A9mxA_CXR8fTNHpjVjDF4vyz3OkxXRfN4mDos_e1vdt…:4052)
like image 268
sa_ Avatar asked Jan 31 '23 00:01

sa_


1 Answers

Finally I found the issue. Somehow it was related with Ajax ScriptManager. I have set ScriptMode="Release" in ScriptManager tag now it is working fine.

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" ScriptMode="Release">
like image 72
sa_ Avatar answered Feb 01 '23 14:02

sa_