小编use*_*695的帖子

mat-select所需的验证不起作用

我有以下代码

<form #createForm="ngForm">
 <mat-form-field>
   <mat-select placeholder="Favorite food"
      matInput
     [ngModel]
     food="food"
     #food="ngModel" required>
    <mat-option *ngFor="let food of foods" [value]="food.value">
      {{ food.viewValue }}
    </mat-option>
   </mat-select>
</mat-form-field>
</form>
<button [disabled]="!createForm.valid">submit</button>
Run Code Online (Sandbox Code Playgroud)

由于我希望"选择"是必填字段,因此在呈现表单时应禁用"提交"按钮.但是,显示表单时会启用"提交"按钮.问题是什么?

angular2-forms angular-material2 angular5 redux-form-validators

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

Net core EF 3.1 LINQ 字符串比较不再起作用

我有以下课程:

public class Employee
{
    public string Name {get; set;}
    ...
}
Run Code Online (Sandbox Code Playgroud)

以及 EF Core 2.1 中的 LINQ 查询

Employee GetEmployeeByName(string name) {
  return Context.Employee.Where ( w =>String.Compare(w.Name, name, true) == 0).FirstOrDefault();
}
Run Code Online (Sandbox Code Playgroud)

转换为Net Core EF 3.1后,出现错误。

无法翻译 LINQ 表达式。以可翻译的形式重写查询,或者通过插入对AsEnumerable()AsAsyncEnumerable()ToList()或 的调用显式切换到客户端评估ToListAsync()

我必须将查询更改为

Employee GetEmployeeByName(string name) {
  return Context.Employee.Where ( w =>w.Name.ToLower() == name.ToLower()).FirstOrDefault();
}
Run Code Online (Sandbox Code Playgroud)

有一个更好的方法吗?

c# linq entity-framework-core ef-core-3.1

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

用于 net core 3.1 api 的 Swagger UI 非常慢

我将我们的网络核心 API 应用程序从 2.1 更新到 3.1,将 SwashBuckle.Asp.NetCore 更新到 5.0.0。这是我的启动集:

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
     string authServerUrl = "http://testserver.com/identityserver4";
         services.AddControllersWithViews();

        services.AddSwaggerGen(c =>
        {
            c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "NetCore API V1" });

            // Define the OAuth2.0 scheme that's in use (i.e. Implicit …
Run Code Online (Sandbox Code Playgroud)

c# swagger swagger-ui .net-core swashbuckle

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

白色空间:预包裹未在第一行对齐

我有以下HTML

<!DOCTYPE html>
 <html>
 <head>
 <style> 
  p.test {
   width: 11em; 
   border: 1px solid #000000;
   word-wrap: break-word;
   white-space: pre-wrap;
 }
 </style>
</head>
<body>
 <p class="test"> This paragraph contains a very long word: thisisaveryveryveryveryveryverylongword.   The long word will break and wrap to the next line.</p>
 </body>
Run Code Online (Sandbox Code Playgroud)

显示页面时,文本的第一行移动一个字母. 在此输入图像描述

如果我更改为"white-space:pre-line",则显示屏不会显示空白区域.如何使第一行与文本的其余部分对齐?

html css

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