小编Ник*_*тев的帖子

在JS中检查数组 - 列表是否排序?

我需要创建一个程序来检查数组中的列表是否已排序.我有三个输入数据:

1,2,3,4,5

1,2,8,9,9

1,2,2,3,2

所以这是我的代码:

let sorts = +gets(); // 3
let list = [];

for (let i = 0; i < sorts; i++) {
    list[i] = gets().split(',').map(Number); // The Array will be: [ [ 1, 2, 3, 4, 5 ], [ 1, 2, 8, 9, 9 ], [ 1, 2, 2, 3, 2 ] ]
}

for (let i = 0; i < list[i][i].length; i++){
    if (list[i][i] < list[i][i +1]) {
        print('true');
    } else {
        print('false');
    }
}
Run Code Online (Sandbox Code Playgroud)

我需要打印新行上的所有列表true或false.对于此示例,我的输出必须是: …

javascript arrays sorting

16
推荐指数
5
解决办法
3043
查看次数

NestJS 无法解析 JWT_MODULE_OPTIONS 的依赖关系

我无法编译并出现此错误:

Nest 无法解析 JWT_MODULE_OPTIONS 的依赖关系(?)。请确保索引 [0] 处的参数在 JwtModule 上下文中可用。+52毫秒

我看到模块和服务存在类似的依赖关系问题,但它们对我不起作用。在我的auth.module.ts中使用 JwtModule :

import { JwtModule } from '@nestjs/jwt';
@Module({
    imports: [
        TypeOrmModule.forFeature([User, Role]),
        ConfigModule,
        PassportModule.register({ defaultStrategy: 'jwt' }),
        JwtModule.registerAsync({
            inject: [ConfigService],
            useFactory: async (configService: ConfigService) => ({
                secretOrPrivateKey: config.jwtSecret,
                type: configService.dbType as any,
                host: configService.dbHost,
                port: configService.dbPort,
                username: configService.dbUsername,
                password: configService.dbPassword,
                database: configService.dbName,
                entities: ['./src/data/entities/*.ts'],
                signOptions: {
                    expiresIn: config.expiresIn,
                },
            }),
        }),

    ],
    providers: [AuthService, JwtStrategy],
    controllers: [AuthController],
})
export class AuthModule { }
Run Code Online (Sandbox Code Playgroud)

我不知道如何修复这个错误...使用jwt 6.1.1

编辑: …

module typescript nestjs

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

使用 ngFor 实现引导表 - Angular

我正在尝试在引导表中添加ngFor数据。

使用https://getbootstrap.com/docs/4.1/content/tables/中的“table-striped table-dark”

但我在 html 文件中做错了,无法修复 id。我将所有日期都放在一栏中。

这是我的 HTML:

<div class="users-container">

  <div class="d-md-flex h-md-100 align-items-center">

    <div class="col-md-6 ">
      <div class="d-md-flex align-items-center text-center justify-content-center">
        <div class="logoarea pt-5 pb-5">
          <h2>All registered users</h2>
        </div>
      </div>
    </div>
  </div>
  <br>
  <br>

  <h3 *ngIf="!users.length">There are no users registered!</h3>

  <table class="table table-striped table-dark">
    <thead>
      <tr>
        <th scope="col">ID</th>
        <th scope="col">Name</th>
        <th scope="col">Email</th>
        <th scope="col">Create on</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <hr *ngIf="users.length">
        <div class="all-users" *ngFor="let users of users">
          <th scope="row">{{users.id}}</th>
          <td>{{users.name}}</td>
          <td>{{users.email}}</td>
          <td></td>
        </div>
      </tr>
    </tbody>
  </table> …
Run Code Online (Sandbox Code Playgroud)

html tabs ngfor angular

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

标签 统计

angular ×1

arrays ×1

html ×1

javascript ×1

module ×1

nestjs ×1

ngfor ×1

sorting ×1

tabs ×1

typescript ×1