0
私は角度2のリリース候補1を使用して、joomlaコンポーネントとして角度2アプリを実装しようとしています。joomlaコンポーネントから角度2ルーティング
index.htmlを
<html>
<head>
<title>Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--CSS-->
<!--<link rel="stylesheet" href="components/com_mycomponent/app/lib/bootstrap.min.css">-->
<link rel="stylesheet" href="components/com_mycomponent/app/styles/styles.css">
<!-- 1. Load libraries -->
<!-- IE required polyfills, in this exact order -->
<script src="components/com_mycomponent/app/lib/shim.min.js"></script>
<script src="components/com_mycomponent/app/lib/zone.js"></script>
<script src="components/com_mycomponent/app/lib/Reflect.js"></script>
<script src="components/com_mycomponent/lib/system.src.js"></script>
<script src="components/com_mycomponent/app/lib/system.config.js""></script>
<script>
System.import('components/com_mycomponent/app/scripts/bootstrapper').catch(function(err){ console.error(err); });
</script>
<base href="/">
</head>
<!-- 3. Display the application -->
<body>
<body>
<my-app>Loading...</my-app>
</body>
</body>
</html>
ブートストラップ:私はこの問題は、私は次のコードを持っている角度アプリへのURLが
localhost/index.php?=com_mycomponent
であるという事実とは何かを持っていると思います.ts
import {bootstrap} from '@angular/platform-browser-dynamic';
import { ROUTER_PROVIDERS } from '@angular/router';
import {ShellComponent} from './shell.component';
import {HTTP_PROVIDERS} from '@angular/http';
bootstrap(ShellComponent, [
HTTP_PROVIDERS,
ROUTER_PROVIDERS
]);
shell.component.ts
import {Component} from '@angular/core';
import {Http} from '@angular/http';
import { ROUTER_DIRECTIVES, Routes} from '@angular/router';
import {BComponent} from 'b.component';
import {AComponent} from 'a.component';
@Component({
selector: 'my-app',
templateUrl: 'components/com_mycomponent/app/html/shell.html',
directives: [ROUTER_DIRECTIVES]
})
@Routes([
{
path: '/b',
component: BComponent
},
{
path: '/',
component: AComponent
}
])
export class ShellComponent{
constructor() {
}
// ngOnInit() {
// this.router.navigate(['/egendefinertrapport']);
// }
}
shell.html
<a [routerLink]="['/b']">BComponent</a>
そして、私は次のエラーメッセージが出ます:
EXCEPTION: Error: Uncaught (in promise): TypeError: Cannot read property 'annotations' of undefined
I bashを変更しようとしましたhrefを '/index.php?option=com_atkstat'に変更してください。これにはrouterLinkとパスも含まれますが、役に立たないものです。何かお手数ですか?