我已成功构建并将我的角度组件部署到asp.net网站。 但问题是,如果我将代码粘贴到body标签下,它可以正常工作。但如果我在表单中粘贴它就不起作用。
所以这在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>
但是,如果我将此代码复制到使用此母版页的另一个网页,则它不起作用,我在控制台中看到以下日志。
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)
答案 0 :(得分:7)
最后我发现了这个问题。 不知何故,它与Ajax ScriptManager有关。 我已经设置了ScriptMode =&#34; Release&#34;在ScriptManager标签中现在它正常工作。
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" ScriptMode="Release">