我有一个要在2个地方使用的组件
GET file:///js/chunk-de72da5c.95253596.js net::ERR_FILE_NOT_FOUND
。当在角材料对话框中使用相同的组件时,我必须注入以下依赖项
x = np.arange(1000)
x2 = np.arange(1000)*2
y = np.sin(x/100.)
fig = plt.figure()
ax = plt.subplot(111)
sns.lineplot(x, y)
plt.xlim(0, 1000)
ax.xaxis.set_major_locator(MultipleLocator(200))
ax2 = ax.twiny()
sns.lineplot(x2, y, visible=False)
plt.xlim(0, 2000)
ax2.xaxis.set_major_locator(MultipleLocator(400))
ax2.spines['top'].set_position(('axes', -0.15))
ax2.spines['top'].set_visible(False)
plt.tick_params(which='both', top=False)
尝试使用<comp-a></comp-a>
, constructor(
public dialogRef: MatDialogRef<CTConfigurationComponent>,
@Inject(MAT_DIALOG_DATA) public dialogData: any,
) {}
,但没有成功。
问题-1: 1.是否可以告诉角度DI跳过一些依赖性?
尝试@Optional()
,并在构造函数中调用
@Skip()
也不起作用。
EDIT-1:
public injector: @Injector
问题-2:
this.dialogRef = this.injector.get(MatDialogRef<CTConfigurationComponent>);
的{{1}}之类的东西?任何建议或解释都会有所帮助
答案 0 :(得分:0)
在您的 app.module.ts 中,您需要导入MatDialogModule
,然后将其添加到imports
属性中
app.module.ts
import {MatDialogModule} from "@angular/material";
@NgModule({
declarations: [CTOnboardingComponent, CTConfigurationComponent, VerifyDomainComponent],
exports: [CTConfigurationComponent, VerifyDomainComponent],
imports: [ CommonModule, MatDialogModule, FormsModule, ReactiveFormsModule, CTAngularImportsModule, CTOnboardingRoutingModule ],
entryComponents: [CTConfigurationComponent, VerifyDomainComponent],
providers: [CTOnboardingService] })
export class CTOnboardingModule {}
答案 1 :(得分:0)
尝试了很多事情之后,我有了解决此错误的方法。在此处发布解决方案,以便对其他人有帮助
所以代替这个
myRack = new PalletRack(this, // Agent owner
SHAPE_DRAW_2D3D, // ShapeDrawMode
true, // isPublic
ground, // ground
false, // isObstacle
-2480, // x pos
1980, // y pos
0.0, // z pos
35.2*numCellsPerRackPerLevel, // length (keep constant cell width and vary rack length accordingly)
20.0, // depth
20.0, // depthR (depth of the right riack (only if type is 2 racks and 1 aisle)
50.0, // levelHeight
0., // rotation
PALLET_RACK_TWO_PALLET_RACKS, // PalletRackType
PALLET_RACK_NO_DIRECTION, // PalletRackDirection
40.0, // aisleDepth = width
40.0, // aisleRDepth (width of right aisle, only if 1 rack 2 aisles)
35.2, // cellWidth
numCellsPerRackPerLevel, // nPositions
numLevelsPerRack, // nLevels
1, // nDeep
lavender, // fillColor
dodgerBlue, // lineColor
2); // cellsBetweenLegs
presentation.add(myRack);
// this must cut through both rack's aisles
MarkupSegmentLine segment = new MarkupSegmentLine(myRack.getX()-10, myRack.getY()+30, 0.0, myRack.getX()+myRack.getLength()+10, v_IMS_Rack1.getY()+30, 0.0);
Path path = new Path(this, SHAPE_DRAW_2D3D, true,
true, true, 1.0, false, 10,
PATH_LINE, dodgerBlue, 1.0,
segment);
presentation.add(myRack);
myNetwork.add( myRack);
myNetwork.add(path);
myNetwork.initialize();
我正在使用以下代码
constructor(
public dialogRef: MatDialogRef<CTConfigurationComponent>,
@Inject(MAT_DIALOG_DATA) public dialogData: any
) {}