小编Jes*_*sse的帖子

获取简短的声明类型名称

我正在使用Asp.Net Core和ASP.NET Identity,当我得到一个Claim类型时,我会得到类似的东西

"type":"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier",
"value":"123"
Run Code Online (Sandbox Code Playgroud)

如何只获取简单类型名称,例如:

"type":"nameidentifier",
"value":"123"
Run Code Online (Sandbox Code Playgroud)

我知道这是可能的我只是找不到解决方案.

c# asp.net-identity asp.net-identity-3 asp.net-core

4
推荐指数
2
解决办法
3362
查看次数

单元测试“角材料”对话框-如何包含MAT_DIALOG_DATA

我正在尝试对该材质对话框进行单元测试,以测试模板是否正在渲染正确的注入对象。正确使用该组件即可正常工作

组件-对话框

export class ConfirmationDialogComponent {

  constructor(@Inject(MAT_DIALOG_DATA) private dialogModel: ConfirmationDialogModel) {}
}
Run Code Online (Sandbox Code Playgroud)

对话框模板

<h1 mat-dialog-title *ngIf="dialogModel.Title">{{dialogModel.Title}}</h1>
<div mat-dialog-content>
  {{dialogModel.SupportingText}}
</div>
<div mat-dialog-actions>
  <button mat-button color="primary" [mat-dialog-close]="false">Cancel</button>
  <button mat-raised-button color="primary"[mat-dialog-close]="true" cdkFocusInitial>{{dialogModel.ActionButton}}</button>
</div>
Run Code Online (Sandbox Code Playgroud)

模型-正在注入什么

export interface ConfirmationDialogModel {
  Title?: string;
  SupportingText: string;
  ActionButton: string;
}
Run Code Online (Sandbox Code Playgroud)

单元测试-问题出在哪里

describe('Confirmation Dialog Component', () => {

  const model: ConfirmationDialogModel = {
    ActionButton: 'Delete',
    SupportingText: 'Are you sure?',
  };

  let component: ConfirmationDialogComponent;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [
        ConfirmationDialogComponent
      ],
      imports: [
        MatButtonModule,
        MatDialogModule
      ],
      providers: [ …
Run Code Online (Sandbox Code Playgroud)

unit-testing karma-jasmine angular-material2 angular angular-testing

4
推荐指数
2
解决办法
4280
查看次数

无法识别 Select-AzureRMSubscription

尝试设置我的 VSTS Windows 构建代理以适应 VSTS 中的 powershell 步骤,但遇到了一些问题。最初它报告说 AzurePS 系统功能不存在,所以我确保通过 powershell 库安装最新的 Azure 模块。现在,AzurePS 功能存在,但某些 powershell 命令似乎不起作用。

这可能根本与 VSTS 无关,而只是我的特定 powershell 安装/配置的配置问题。完整的错误如下:

术语“Select-AzureRMSubscription”不被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。

在我尝试执行的特定定义的 VSTS 发布日志中以及尝试直接在框本身上运行 Select-AzureRMSubscription 命令时,都可以看到此错误。

powershell azure azure-devops

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

如何在使用only-child时避免悬停样式

我使用独子选择器来显示特定的背景颜色,使用悬停样式来显示不同的背景颜色.问题是,当只有一个孩子时,我不希望悬停样式工作.我怎样才能做到这一点?

1)没有红色背景,但是当我们悬停时它会变为绿色背景

.report p:only-child {
  background: red;
}

.report p:hover {
  background: green;
}
Run Code Online (Sandbox Code Playgroud)
<div class="report">
  <p>Test1</p>
  <p>Test2</p>
</div>
Run Code Online (Sandbox Code Playgroud)

2)红色背景,但我们悬停时没有绿色背景

.report p:only-child {
  background: red;
}

.report p:hover {
  background: green;
}
Run Code Online (Sandbox Code Playgroud)
<div class="report">
  <p>Test1</p>
</div>
Run Code Online (Sandbox Code Playgroud)

html javascript css hover

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

Identity Server4连接/令牌端点提供400 Bad Request

我们正在使用EntityFrameworkCore与Identity Server4.初始设置后,身份server(localhost:6000/.well-known/openid-configuration)的发现端点工作正常.当我们尝试connect/token从邮递员调用端点时,它会给出400个错误的请求响应.这是我们的客户:

public static IEnumerable<Client> GetClients()
{
    return new List<Client>
    {
        new Client
        {
            ClientId = "client",

            // no interactive user, use the clientid/secret for authentication
            AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,

            // secret for authentication
            ClientSecrets =
            {
                new Secret("secret".Sha256())
            },

            // scopes that client has access to
            AllowedScopes = { ApiResourceName.Sup_Api.Description() }
        },
        new Client
        {
            ClientId = "client2",

            // no interactive user, use the clientid/secret for authentication
            AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,

            // secret for authentication
            ClientSecrets = …
Run Code Online (Sandbox Code Playgroud)

identityserver4

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

垫式onclick事件功能

想知道是否有可能发生“垫式踏步”按钮的点击事件。对于每个垫步按钮,我想添加一个(click)调用的事件method。换句话说,垫步按钮的作用类似于常规按钮。

这是基本步骤:https : //material.angular.io/components/stepper/overview

这是我的代码:

<mat-step>
<ng-template matStepLabel (click) = "createView()">Output</ng-template>
</mat-step>
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

模板解析错误:嵌入式模板上的任何指令都不会发出事件绑定单击。确保事件名称拼写正确,并且所有指令均在“ @ NgModule.declarations”中列出。(“ eateView()”>输出->

typescript angular-material angular

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

使用 Router 将变量设置为 Aurelia 中的路由标题

我想在我的路线标题中设置一个路线参数。

\n\n

基本上,我想做这样的事情:

\n\n
configureRouter(config: RouterConfiguration, router: Router): void {\n  config.map([\n    { \n      route: ":var1", \n      name: "myName", \n      title: "my title" + " n\xc2\xb0 " + ":var1", \n      moduleId: "x/y/z" \n    }\n  ]);\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

我想将字符串与我的路线参数连接起来,其中var1是我的路线参数。

\n\n

我怎样才能做到这一点?

\n

typescript aurelia

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

如何使用webpack在aurelia电子应用程序中使用syncfusion?

我有Aurelia,Electron和Webpack工作,但我想包括Syncfusion的CDN版本.在普通的Web应用程序中,您可以将其包含在HTML文件中,但是如何将其包含在Aurelia Electron Webpack应用程序中?

在我的app.html我有以下代码:

<require from="http://cdn.syncfusion.com/js/assets/external/jquery-1.10.2.min.js"></require>
<require from="http://cdn.syncfusion.com/js/assets/external/jsrender.min.js"></require>
<require from="http://cdn.syncfusion.com/16.3.0.29/js/web/ej.web.all.min.js"></require>
Run Code Online (Sandbox Code Playgroud)

syncfusion webpack aurelia electron

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

如何使用Fetch和Aurelia打印结果消息以发送表单数据

当我尝试在Aurelia中使用fetch发布表单的数据并在同一网页上打印出一条消息(如果成功)时,我收到错误"Unhandled rejection TypeError:无法设置未定义的属性'resultMessage'($ {resultMessage}) .

this.resultMessage ="新书增加"; <=此行导致错误

add.js:

import {HttpClient, json} from 'aurelia-fetch-client'

export class AddBooks{

    bookData = {}

    constructor() {
        this.resultMessage = ""
    }

    activate() {
         let client = new HttpClient();
    }

    addBook() {
        let client = new HttpClient();

        client.fetch('{address}', {
            'method': "POST",
            'body': json(this.bookData)
        })
        .then(function(response) {
           return response.json();
        })
       .then(function(data) {
          if(data.id) {
             console.log(JSON.stringify(data));
             this.resultMessage = "New book added"; 
        }
     });
    }
}
Run Code Online (Sandbox Code Playgroud)

add.html:

<template>

  <form id="bookaddform" method="post" submit.delegate="addBook()">
    <div>
      <label for="bookTitle">Book Title</label>
      <input id="bookTitle" type="text" …
Run Code Online (Sandbox Code Playgroud)

javascript fetch aurelia

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

为什么是fontSize?为什么font-size不起作用?

当我在DevTool上更改标题字体大小时,我注意到我无法使用

heading.style.font-size = '2em';
Run Code Online (Sandbox Code Playgroud)

但我不得不使用

heading.style.fontSize = '2em';
Run Code Online (Sandbox Code Playgroud)

这是为什么?

html javascript css dom

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

如何在C#中查询多个值的列表

我想有这个数组 int[] ageArray=[11,12,13]

以及包含这些对象的列表:

 public class temp
 {
     string name;
     string age;
 }
Run Code Online (Sandbox Code Playgroud)

现在我想用agein 检索列表中的所有项目ageArray,因为大小ageArray不知道它将是动态的.是否可以使用List.SelectList.Where使用数组查询List.

例如

List.Select(row=> row.age in ageArray)
Run Code Online (Sandbox Code Playgroud)

这种解决方案?

c# linq list

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

While循环使数组不可用

我有以下代码

function slotCalc(a, b) {
  var array = ["default"];
  while (a < b) {
    var obj = { test: "test" };
    array.push(obj);
    b++;
  }
  return array;
}
Run Code Online (Sandbox Code Playgroud)

我不明白为什么不返回数组。如果删除while循环,则按预期返回。

while循环如何执行此操作?

javascript

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

仅使用其URL更改图像高度

假设我们有以下HTML:

<img src="IMAGE-URL" /> 
Run Code Online (Sandbox Code Playgroud)

我需要在CSS中更改图像高度,而无需添加类或ID.

我怎么用CSS写这个IMAGE-URL height: 100px呢?

html css

-5
推荐指数
1
解决办法
93
查看次数