Angular2 不适用于 prototype.js
Angular2 not working with prototype.js
我正在尝试在使用 prototype.js 的现有应用程序中设置 Angular2。但是看起来 Angular2 也依赖于 prortotype.js(如果我错了请纠正我)因此抛出一个 "maximum call stack size exceeded RangeError(in Chrome)"
尝试加载应用程序时。我是 Angular2 的新手。
我可以通过添加 prototype.js 依赖项在 Angular2 快速入门应用程序中重现它。
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
<link rel="stylesheet" href="styles.css">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
</head>
<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>
Web 检查器控制台中的部分堆栈跟踪是:
Error: (SystemJS) Maximum call stack size exceeded RangeError: Maximum
call stack size exceeded at ParamDecoratorFactory
(http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:401:39)
at new
(https://cdnjs.cloudflare.com/ajax/libs/prototype/1.6.0.3/prototype.js:214:23)
at ParamDecoratorFactory
我做错了什么?或者如果没有,是否有解决方法?
提前致谢!
转到 prototype.js
的文件。
添加
var bindTemp = Function.prototype.bind;
在文件开头。
添加
Function.prototype.bind = bindTemp;
在文件末尾。
它现在应该可以工作了。
致谢:Solution
我正在尝试在使用 prototype.js 的现有应用程序中设置 Angular2。但是看起来 Angular2 也依赖于 prortotype.js(如果我错了请纠正我)因此抛出一个 "maximum call stack size exceeded RangeError(in Chrome)"
尝试加载应用程序时。我是 Angular2 的新手。
我可以通过添加 prototype.js 依赖项在 Angular2 快速入门应用程序中重现它。
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
<link rel="stylesheet" href="styles.css">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
</head>
<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>
Web 检查器控制台中的部分堆栈跟踪是:
Error: (SystemJS) Maximum call stack size exceeded RangeError: Maximum call stack size exceeded at ParamDecoratorFactory (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:401:39) at new (https://cdnjs.cloudflare.com/ajax/libs/prototype/1.6.0.3/prototype.js:214:23) at ParamDecoratorFactory
我做错了什么?或者如果没有,是否有解决方法?
提前致谢!
转到 prototype.js
的文件。
添加
var bindTemp = Function.prototype.bind;
在文件开头。
添加
Function.prototype.bind = bindTemp;
在文件末尾。 它现在应该可以工作了。
致谢:Solution