每当我将图表转储到主app.component.html时似乎都很好,但是只要我在子组件中使用它并将应用程序路由到它,图表就不会显示出来.在检查器窗口中,它将元素显示为0高度和0宽度.有人有解决方案吗?
这是我的app.component.ts的代码:
import {Component} from 'angular2/core';
import {RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router';
import {HomeComponent} from './home.component';
import {ProfileComponent} from './profile.component';
import {HoursComponent} from './hours.component';
import {SettingsComponent} from './settings.component';
import {TaskComponent} from './task.component';
import {ChartDirective} from './chart.directive';
@Component({
selector: 'track-me',
templateUrl: 'app/app.component.html',
directives: [ROUTER_DIRECTIVES,ChartDirective]
})
@RouteConfig([
{ path: '/', component: HomeComponent, name: 'Home' },
{ path: '/home', component: HomeComponent, name: 'Home' },
{ path: '/profile', component: ProfileComponent, name: 'Profile' },
{ path: '/hours', component: HoursComponent, name: 'Hours' },
{ path: '/settings', component: …Run Code Online (Sandbox Code Playgroud)