小编Toh*_*eeb的帖子

如何使用带有 sha512 算法的 JavaScript 散列字符串

我试过使用 NPM 的 sha512,但它一直在散列错误的东西,即我应该得到一个字符串,但它一直在返回对象。所以在 PHP 中我知道我可以执行任务$hash = hash("sha512","my string for hashing");

如何在 nodejs JavaScript 上执行此任务

javascript server-side node.js mean-stack

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

使用粘性表末尾的更多按钮将 Angular 材质菜单添加到 Angular 材质表中的每一行

我有一个粘性表,我想添加more_vert button切换,但我无法实现这一点,因为我不知道如何区分彼此drop down menu list

我想在点击时看到的用户界面示例

该表是来自 REST API 的用户数据列表,每行的菜单应显示: - delete user - edit user profile 当我单击more button

到目前为止,我一直遵循材质菜单和粘性表的文档,但每次单击按钮时都会在任何行上显示下拉列表

     <ng-container matColumnDef="actions" stickyEnd>
         <th mat-header-cell *matHeaderCellDef mat-sort-header> </th>                  
         <td mat-cell *matCellDef="let user"> 
            <button mat-icon-button [matMenuTriggerFor]="user.user_id" aria-label="">
                <mat-icon>more_vert</mat-icon>
            </button>
            <mat-menu #appMenu="user.user_id">
              <button mat-menu-item>Delete</button>
              <button mat-menu-item>Edit</button>
            </mat-menu>  
        </td>
     </ng-container>
Run Code Online (Sandbox Code Playgroud)

angular-material angular

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

当我尝试打开角度材质对话框时,Angular7 Modal StaticInjectorError

每次单击Modal Button我都会收到以下错误。

UserProfileDialog 是我的对话框组件,

Error: StaticInjectorError(AppModule)[UserProfileDialog -> InjectionToken MatDialogData]:    StaticInjectorError(Platform: core)[UserProfileDialog -> InjectionToken MatDialogData]:      NullInjectorError: No provider for InjectionToken MatDialogData!     at NullInjector.push../node_modules/@angular/
Run Code Online (Sandbox Code Playgroud)

我在这里尝试了所有相关的解决方案,但没有一个工作正常。

dashboard.component.ts 这是我有一个列出所有用户的表格,点击一行上的按钮,它应该显示该用户的完整个人资料

 viewUserProfile(userId: string){
    const dialogRef = this.dialog.open(UserProfileDialog);

    dialogRef.afterClosed().subscribe(result => {
      console.log(`Dialog result: ${result}`);
    });
  }

@Component({
  selector: 'user-profile-dialog',
  templateUrl: './user-profile.component.html',
  // styleUrls: ['./dashboard.component.scss']
})
export class UserProfileDialog {

  constructor(
    public dialogRef: MatDialogRef<UserProfileDialog>,
    @Inject({'data':'MAT_DIALOG_DATA'}) public data: any) {}

  onNoClick(): void {
    this.dialogRef.close();
  }

}
Run Code Online (Sandbox Code Playgroud)

app.module.ts

import { FileSelectDirective } from 'ng2-file-upload';
import { BsDropdownModule } …
Run Code Online (Sandbox Code Playgroud)

angular angular-material-7

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