小编Ans*_*wal的帖子

以角度2动态加载外部模块

我有node.js应用程序,托管angular2应用程序.整个应用程序使用这样的延迟加载:

export const routes: Routes = [
    {
        path: '', component: MyComponent,
        children: [
            {
                path: 'lazy',
                loadChildren: '../common/lazy/lazy.module#LazyModule'
            }
    }
]
Run Code Online (Sandbox Code Playgroud)

我公司的另一个团队正在构建另一种软件,但我们想重用一些模块.我们不想严格共享代码库,而是公开托管模块并让它由应用程序本身加载,以便我们可以做这样的事情

export const externalRoutes: Routes = [
    {
        path: 'externalModule',
        loadChildren: 'http://mymodules.host/lazy.module#LazyModule'
    }
]
Run Code Online (Sandbox Code Playgroud)

是否可以在"实时"应用程序中加载模块?我知道有类似动态组件加载器的东西,但我们需要加载一个包含大量组件的模块.

angular2-routing angular

6
推荐指数
1
解决办法
1062
查看次数

FilterPredicate 表(按具有 Angular 材质的列)

我想使用谓词过滤器按列过滤我的 mat-table 结果。我已经使用了一个简单的过滤器,但它过滤了所有列中的所有数据。我搜索类似的主题,但我不知道如何使用它。我尝试对所有列重复我的代码,但不起作用。

请参阅下面的代码:

<mat-form-field>
  <input matInput (keyup)="applyFilter($event.target.value)" placeholder="Filter">
</mat-form-field>
<div class="example-container mat-elevation-z8">
    <div class="example-header">
        <div>
            <mat-table [dataSource]="dataSource" matSort>
                <ng-container matColumnDef="aa">
                    <mat-header-cell *matHeaderCellDef mat-sort-header>aa title</mat-header-cell>
                    <mat-cell *matCellDef="let user"> {{user.aa}} </mat-cell>
                </ng-container>
                <ng-container matColumnDef="bb">
                    <mat-header-cell *matHeaderCellDef mat-sort-header> bb tilte </mat-header-cell>
                    <mat-cell *matCellDef="let user"> {{user.bb}} </mat-cell>
                </ng-container>
                <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
                <mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
            </mat-table>
            <mat-paginator [pageSizeOptions]="[5, 10, 25, 100]"></mat-paginator>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

和我的.ts

export class MynewComponent implements OnInit {
    dataSource = new MatTableDataSource();
    displayedColumns = ['aa', 'bb'];
    @ViewChild(MatPaginator) paginator: …
Run Code Online (Sandbox Code Playgroud)

angular-material angular

2
推荐指数
1
解决办法
7718
查看次数

如何更新状态条标签上显示的文本

我在主表单上创建了一个状态栏,并在其中创建了一个标签.我在这里打开另一种形式(MdiContainer是真的).为了打开我在构造函数中传递主窗体的对象,即这.在那里,我正在更新标签的文本,但它没有得到更新.我也试过了无效功能.

.net c# winforms

1
推荐指数
1
解决办法
8562
查看次数

Mat-Select 返回 undefined

我正在使用 Angular 材料并使用 Mat-Select。当用户进行选择时,我想抓取一个用户,该用户实际上是一个具有 Id 和 description 属性的对象。

<mat-form-field>
    <mat-select placeholder="Select User Type"  (selectionChange)="selectUserType(user)">
        <mat-option  *ngFor="let user of userTypeList" [value]="user.description">
            {{ user.description }}
        </mat-option>
    </mat-select>
</mat-form-field> 
Run Code Online (Sandbox Code Playgroud)

当用户进行选择时,我在这里收到未定义的信息:

public selectUserType(userType: OxygenUserType) {
    console.log('selected');
    this.selectedUserType = userType;
    console.log(this.selectedUserType);
}
Run Code Online (Sandbox Code Playgroud)

我也试过,(selectionChange)="selectUserType($event.value)"但这不会产生一个对象。我需要用户选择是一个看起来像这样的对象:

{id:1, description:Agent},
{id:2, description:Dealer}
Run Code Online (Sandbox Code Playgroud)

这个对象基于这个接口

export interface OxygenUserType {
    id: number;
    description: string;
}
Run Code Online (Sandbox Code Playgroud)

javascript angular-material angular

1
推荐指数
1
解决办法
4335
查看次数

使用静态时获取所需的错误根路径

任何帮助或建议将不胜感激。

C:\Program Files\nodejs\node_global\node_modules\express\node_modules\serve-static\index.js:40 throw new TypeError('root path required') ^

类型错误:Function.serveStatic 需要根路径 [作为静态] (C:\Program Files\nodejs\node_global\node_modules\express\node_modules\serve-static\index.js:40:11) 在 Object. (C:\Users\joe\Downloads\fine\nodejs.js:40:40) 在 Module._compile (module.js:652:30) 在 Object.Module._extensions..js (module.js:663:10) ) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js) :693:10) 在启动时 (bootstrap_node.js:191:16) 在 bootstrap_node.js:612:3`

我使用的唯一静态路径是。

app.use(express.static(publicDir));
app.use("/node_modules", express.static(nodeModulesDir));

app.post("/uploads", onUpload);
app.delete("/uploads/:uuid", onDeleteFile);
Run Code Online (Sandbox Code Playgroud)

node.js express

1
推荐指数
1
解决办法
2272
查看次数