我是angular2的新手,需要帮助。我正在开发一个angular2应用程序,其后端是用Java Spring编写的。该应用程序之前运作良好。我没有更改任何代码,但现在当我在chrome中加载它时,它仍然在加载时...我检查了控制台但没有错误。如果我尝试在firefox或safari中打开它,它加载完美但在Firefox中我无法提交表单(可能是兼容性问题?)。
应用程序是用#34; angular2":" 2.0beta.0-.14" 。由于Angular2 RC5已经发布,所以代码已经过时了吗? 我是否应该对代码进行更改?
的index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BMIS</title>
<base href="/">
<!-- Angular JS -->
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js',
}
},
map: {
"angular2-jwt": "node_modules/angular2-jwt/angular2-jwt.js"
}
});
System.import('app/main')
.then(null, console.error.bind(console));
</script>
<!-- Angular JS -->
<!-- Bootstrap -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" />
<link href="assets/css/custom.css" rel="stylesheet" />
<!-- Bootstrap -->
<!-- Timeline css -->
<link href="assets/css/timeline.min.css" rel="stylesheet" />
<!-- Timeline css -->
<!-- Navigation -->
<link href="assets/css/navbar.css" rel="stylesheet" />
<script src="assets/js/navbar.js" type="text/javascript"></script>
<!-- Navigation -->
<!-- Font Awesome -->
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<!-- Font Awesome -->
</head>
<body>
<app>Loading...</app>
</body>
</html>
的package.json
{
"name": "abcd",
"version": "1.0.0",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"typings": "typings",
"postinstall": "typings install"
},
"license": "ISC",
"dependencies": {
"angular2": "2.0beta.0-.14",
"es6-promise": "^3.0.2",
"es6-shim": "^0.35.0",
"ng2-radio-group": "0.0.2",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"systemjs": "0.19.24",
"zone.js": "0.6.10"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"typescript": "^1.8.9",
"typings": "^0.7.9"
}
}
答案 0 :(得分:0)
您必须遵循升级路径。第一步是检查RC1的升级路径:
如果您没有routing
接下来将升级到 RC5 。主要的突破性变化是使用NgModules
进行自举。检查https://angular.io/docs/ts/latest/cookbook/rc4-to-rc5.html以了解具体步骤。