我有一个基于角度2构建的遗留代码。这是我在名为users.input.ts的文件上的代码。它编译成功。但是当我尝试构建时,我得到了编译错误。任何人都可以帮助我做我必须做的事情吗?
输入select.ts
import { Component, Input, Output, EventEmitter, OnChanges, SimpleChange } from '@angular/core';
import { InputSelectSearchComponent } from '../input-select-search/input-select-search.component';
import { InputBase } from '../../classes/input-base';
import { UIStylekitService } from '../../ui-stylekit.service';
export class InputSelect extends InputBase<string> {
controlType = 'select';
options: {value: string, label: string}[] = [];
constructor(options: {} = {}) {
super(options);
this.options = options['options'] || [];
}
}
@Component({
selector: 'input-select',
templateUrl: 'input-select.component.html',
inputs: ['form','input']
})
export class InputSelectComponent extends InputSelectSearchComponent {
constructor(
private __Stylekit: UIStylekitService ) {
super(__Stylekit);
}
}
users.input.ts
import { InputBase, InputSelect } from '../../../ui-stylekit';
export const UsersInputs: InputBase<any>[] = [
new InputSelect({
key: 'title',
label: 'Title',
options: [
{ value: 'Mr', label: 'Mr'},
{ value: 'Mrs', label: 'Mrs'},
{ value: 'Miss', label: 'Miss'},
{ value: 'Ms', label: 'Ms'},
{ value: 'Prof', label: 'Prof'},
{ value: 'Dr', label: 'Dr'}
],
required: false,
groupClass: 'half',
})
];
admin.routes.ts
import { Routes } from '@angular/router';
import { AdminGuard } from '../shared/';
import { AdminComponent } from './admin.component';
import { ListComponent, UpdateComponent, CreateComponent } from '../ui/components/';
import { UsersInputs } from '../shared/config/';
import { UsersConfig } from '../shared/config/';
export const AdminRoutes: Routes = [
{
path: 'admin',
component: AdminComponent,
children: [
{ path: 'users', component: ListComponent, data: { config: UsersConfig }, canActivate: [AdminGuard] },
{ path: 'users/edit/:id', component: UpdateComponent, data: { config: UsersConfig, inputs: UsersInputs }, canActivate: [AdminGuard] },
{ path: 'users/create', component: CreateComponent, data: { config: UsersConfig, inputs: UsersInputs }, canActivate: [AdminGuard] },
]
}
];
错误
错误中的错误:静态解析符号值时出错。 调用函数&#39; InputSelect&#39;,不支持函数调用。 考虑使用对a的引用替换函数或lambda 导出功能