而不是将数据显示到表格的常规方式。我正在尝试创建我的自定义表组件并通过 .
像这样:
<table mat-table [dataSource]="dataSource">
<!-- I want to Render the header and cell data here -->
<ng-content></ng-content>
<mat-header-row *matHeaderRowDef="headers; sticky: true"></mat-header-row>
<mat-row *matRowDef="let row; columns: headers;"></mat-row>
</table>
Run Code Online (Sandbox Code Playgroud)
所以我可以像这样调用这个自定义组件:
<app-customized-table>
<ng-container matColumnDef="id">
<mat-header-cell *matHeaderCellDef> Id </mat-header-cell>
<mat-cell *matCellDef="let element"> {{element.Id}} </mat-cell>
</ng-container>
...etc
</app-customized-table>
Run Code Online (Sandbox Code Playgroud)
但是,它不会检测内容。这是我正在尝试做的一个 stackblitz 示例。
https://stackblitz.com/edit/angular-qwvcln?file=src%2Fapp%2Fcustom-table.component.ts
有没有办法做到这一点?
谢谢。
你怎么能得到你当前的路线并得到它的数据,孩子和它的父母?
如果这是路线结构:
const routes: Routes = [
{path: 'home', component: HomeComponent, data: {title: 'Home'}},
{
path: 'about',
component: AboutComponent,
data: {title: 'About'},
children: [
{
path: 'company',
component: 'CompanyComponent',
data: {title: 'Company'}
},
{
path: 'mission',
component: 'MissionComponent',
data: {title: 'Mission'}
},
...
]
},
...
]
Run Code Online (Sandbox Code Playgroud)
如果我目前在CompanyComponent,我如何得到我当前的路线w/c是公司,得到它的父母w/c是关于,它的数据和它的兄弟姐妹,如任务等?
主要问题:有没有办法显示到父路由器出口的子路由?
请考虑Angular.io路由器指南中的这个示例。
主要路线片段:
const appRoutes: Routes = [
...
{
path: 'admin',
loadChildren: 'app/admin/admin.module#AdminModule',
canLoad: [AuthGuard]
},
{
path: 'crisis-center',
loadChildren: 'app/crisis-center/crisis-center.module#CrisisCenterModule',
data: { preload: true }
},
....
];
Run Code Online (Sandbox Code Playgroud)
主要组件片段:
@Component({
selector: 'app-root',
template: `
<h1 class="title">Angular Router</h1>
<nav>
<a routerLink="/crisis-center" routerLinkActive="active">Crisis Center</a>
<a routerLink="/superheroes" routerLinkActive="active">Heroes</a>
<a routerLink="/admin" routerLinkActive="active">Admin</a>
...
</nav>
<router-outlet></router-outlet>
`
})
Run Code Online (Sandbox Code Playgroud)
危机中心路线片段:
const crisisCenterRoutes: Routes = [
{
path: '',
component: CrisisCenterComponent,
children: [
{
path: '',
component: CrisisListComponent,
children: [
{
path: ':id',
component: …
Run Code Online (Sandbox Code Playgroud) 为了让我从本地获取JSON文件中的数据,我应该使用哪些方法或方法.
$.getJSON
在Firefox中运行正常,但是除非你在localhost上运行,否则chrome不起作用.
我想在chrome中正确运行它(因为android使用chrome)而不使用xampp等本地主机服务器,并且还在safari上运行它(iOS使用safari).
我将在Android和iOS上运行它
美好的一天!有人可以帮助我如何将此sql语句转换为linq?我正在使用Telerik数据访问.
谢谢.
SELECT pay.Cutoff,
emp.Id,
emp.LastName,
job.Rate * 25 AS FixBIR,
(SELECT COUNT(*) AS MonthsWorked
FROM payroll AS pay3
WHERE YEAR(pay3.DateGenerated) = 2014
AND pay3.EmployeeId = 1
AND pay3.Cutoff = 1
ORDER BY MONTH(pay3.DateGenerated) ASC) * (job.Rate * 25)
AS MonthsWorked_FixBIR_TODATE
FROM employee AS emp
INNER JOIN payroll AS pay
ON emp.Id = pay.EmployeeId
INNER JOIN job
ON emp.JobId = job.Id
WHERE pay.Cutoff = 1
AND pay.PayrollMonth = 'August'
AND Year(pay.DateGenerated) = 2014
Run Code Online (Sandbox Code Playgroud)