我有以下代码
<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
我有以下课程:
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)
有一个更好的方法吗?
我将我们的网络核心 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) 我有以下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",则显示屏不会显示空白区域.如何使第一行与文本的其余部分对齐?
c# ×2
.net-core ×1
angular5 ×1
css ×1
ef-core-3.1 ×1
html ×1
linq ×1
swagger ×1
swagger-ui ×1
swashbuckle ×1