这个问题很简单,但我无法摆脱它.
我有一个<header>父模板,我需要它通过路由模块显示子模板时消失.我期望在header标签中添加一个类,以便我可以通过CSS隐藏它.这就是我所拥有的:
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: `
<header [class.hidden]="hide">
<h1>My App</h1>
<ul>
<li><a href="/home"></a></li>
<li><a href="/showoff"></a></li>
</ul>
</header>
<router-outlet></router-outlet>
`
})
export class AppComponent {
hide = false; // <-- This is what I need to change in child component
}
Run Code Online (Sandbox Code Playgroud)
APP-routing.module.ts
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent } from './welcome.component';
import { ShowOffComponent } from './show.off.component';
const routes: Routes = [
{ path: '', component: HomeComponent …Run Code Online (Sandbox Code Playgroud) 我是 Tradingview 图表库的新手,我想创建类似的响应式图表。
问题是,交易视图图表库需要指定宽度和高度。这是代码。
const chart = LightweightCharts.createChart(e, {
width: e.offsetWidth,
height: e.offsetHeight,
layout: {
backgroundColor: 'rgb(17, 17, 39)',
textColor: 'rgba(255, 255, 255, 0.9)',
},
grid: {
vertLines: {
color: 'rgb(41, 44, 58)',
},
horzLines: {
color: 'rgb(41, 44, 58)',
},
},
crosshair: {
mode: LightweightCharts.CrosshairMode.Normal,
},
priceScale: {
borderColor: 'rgba(197, 203, 206, 0.8)',
},
timeScale: {
borderColor: 'rgba(197, 203, 206, 0.8)',
},
});
Run Code Online (Sandbox Code Playgroud)