0
私は自分のサイトを通過するときにアドレスバーのURLを変更したいと思います。現在、appフォルダは、アプリケーションフォルダの{コンポーネント、コントローラ、モデル、パブリック、ルート、サービス、ビュー}フォルダを持つルートフォルダにあります。 appのリンクをクリックすると、URLは更新されません。私は、矛盾しないAPIルートを持つNodeバックエンドを使用しています。どんな助け?アドレスバーが角度2でルート変更を更新しない
package.jsonの依存関係:
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router": "^3.0.0-alpha.7",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.1",
"angular2": "^2.0.0-beta.17",
"angular2-in-memory-web-api": "0.0.11",
"bcrypt-nodejs": "latest",
"body-parser": "~1.0.0",
"bootstrap": "^3.3.6",
"connect-flash": "~0.1.1",
"cookie-parser": "~1.0.0",
"core-js": "^2.4.0",
"ejs": "~0.8.5",
"express": "~4.0.0",
"express-session": "~1.0.0",
"method-override": "~1.0.0",
"mongoose": "~3.8.1",
"morgan": "~1.0.0",
"passport": "~0.1.17",
"passport-facebook": "~1.0.2",
"passport-google-oauth": "~0.1.5",
"passport-local": "~0.1.6",
"passport-twitter": "~1.0.2",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.27",
"typescript": "^1.8.10",
"typings": "^1.0.4",
"zone.js": "^0.6.12"
}
のindex.html:
<!DOCTYPE html>
<html>
<head>
<base href="/">
<title>Todo List</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<style>
body { padding-top:80px; }
</style>
<!-- 1. Load libraries -->
<!-- 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/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
</html>
ルート:
import { provideRouter, RouterConfig } from '@angular/router/index';
import { IndexComponent } from "../components/index.component";
import { ProfileComponent } from "../components/profile.component";
import { SignupComponent } from "../components/signup.component";
export const appRoutes: RouterConfig = [
{ path: '', component: IndexComponent },
{ path: 'profile', component: ProfileComponent },
{ path: 'signup', component: SignupComponent }
];
export const APP_ROUTER_PROVIDER = [provideRouter(appRoutes)];