小编umu*_*sen的帖子

将角度材料表中的一个 mat-h​​eader-cell 与排序标题对齐

我正在尝试将表格中的标题之一对齐。我试过:

.header-align-right {
    display: flex;
    justify-content: flex-end;
  }
Run Code Online (Sandbox Code Playgroud)

在一个类中并将其添加到mat-header-cell. 这使文本右对齐,但也为元素添加了奇怪的间距,使其与其余标题不对齐。在没有的情况下也尝试过,display:flex但是什么也没做。

<ng-container matColumnDef="Number">
        <th mat-header-cell *matHeaderCellDef mat-sort-header class="header-align-right">Number</th>
        <td mat-cell *matCellDef="let row" align="right">{{row.Number}}</td>
        <td mat-footer-cell *matFooterCellDef></td>
</ng-conIainer>
Run Code Online (Sandbox Code Playgroud)

如您所见,我将单元格的内容对齐,并且我也想对齐标题。

css angular-material angular

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

jQuery使用Summernote编辑器验证错误:无法读取未定义的属性'replace'

我正在使用MVC5使用summernote编辑器构建表单.

剃刀代码:

<div class="form-group">
      @Html.LabelFor(model => model.Content, htmlAttributes: new { @class = "control-label" })
      @Html.EditorFor(model => model.Content, new { htmlAttributes = new { @class = "form-control post-content"} })
      @Html.ValidationMessageFor(model => model.Content, "", new { @class = "text-danger" })
</div>
Run Code Online (Sandbox Code Playgroud)

JS:

$('#blog-form .post-content').summernote({
  height: 400,                
  minHeight: 300,            
  codemirror: {
    theme: 'default'
  }
});
Run Code Online (Sandbox Code Playgroud)

通过上面的设置,编辑器控件呈现得很好.但是,一旦我离开编辑器,即onBlur,我在控制台中收到以下错误:

Uncaught TypeError: Cannot read property 'replace' of undefined
    at $.validator.escapeCssMeta (jquery.validate.js:1014)
    at $.validator.errorsFor (jquery.validate.js:995)
    at $.validator.prepareElement (jquery.validate.js:679)
    at $.validator.element (jquery.validate.js:466)
    at $.validator.onfocusout (jquery.validate.js:289)
    at HTMLDivElement.delegate (jquery.validate.js:411)
    at …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-validate razor asp.net-mvc-5

12
推荐指数
4
解决办法
8514
查看次数

.Net Core 2中的模拟Hangfire RecurringJob依赖

考虑以下控制器:

public class SubmissionController : Controller
{ 
    public SubmissionController()
    { }

    public IActionResult Post()
    {
        RecurringJob.AddOrUpdate(() => InitiateSubmission(), Cron.Minutely);

        return Ok("Periodic submission triggered");
    }
}
Run Code Online (Sandbox Code Playgroud)

Hangfire是否提供抽象为RecurringJob类注入依赖项?我已经做过一些研究,唯一可用的抽象是IBackgroundJobClient,它没有安排定期工作的选项。

我需要验证该作业已在单元测试中添加。

c# dependency-injection hangfire asp.net-core-2.0

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

ef core 2.0 使用包含过滤器搜索多列

假设实体Patient存在于上下文中,该实体已使用数据库优先方法生成,因此我无法修改数据库。

public class Patient
{
   public string Id { get; set; }
   public string Surname { get; set; }
   public string Forename { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我想按姓名过滤患者,例如名字或姓氏或全名。我目前有以下查询:

await query
         .Where(p => p.Forename != null && p.Forename.ToLower().Contains(filter) ||
                     p.Surname != null && p.Surname.ToLower().Contains(filter))
         .ToListAsync();
Run Code Online (Sandbox Code Playgroud)

这显然只单独检查名字/姓氏列。如果过滤器是全名,则不起作用。

我尝试在 where 子句中进行字符串插值,以针对名字和姓氏的组合应用 contains 过滤器,但它在 ef 核心中不受支持并在本地执行。由于数据库中有超过一百万的患者,因此在应用程序中本地执行查询不是一种选择,必须在数据库中完成(搜索需要一分钟以上)。

有没有办法解决这个问题?

c# entity-framework .net-core ef-core-2.0

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

如何将 ILogger&lt;T&gt; 依赖项注入 ConfigureServices - .net core 2.0 中的服务

我有以下几点MailService

public class MailService : IMailService
{
    private readonly ILogger<MailService> _logger;
    private readonly SmtpClient _client;

    public MailService(ILogger<MailService> logger, SmtpClient client)
    {
        _logger = logger;
        _client = client;
    }

    public async Task Send(string to, string subject, string body)
    {
        var message = new MailMessage
        {
            Subject = subject,
            Body = body,
            IsBodyHtml = true,
            From = new MailAddress("info@domain.com")
        };

        message.To.Add(to);

        using (_client)
        {
            _logger.LogTrace($"Sending email from {message.From.Address} to {to}. Subject: {subject}");
            await _client.SendMailAsync(message);
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

我想使用实现工厂创建此服务,因为我将从配置中读取 smtp 设置并提供 …

c# dependency-injection asp.net-core-2.0 .net-core-logging

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

Mat-table呈现行,但不呈现数据

我在我的项目中使用Angular 5和材料垫表。

在我的组件文件中,我使用observable从服务中检索数据并将其绑定到组件上的变量。Mat-table显示行,但不打印数据。我尝试了ngFor,它似乎可以工作。控制台中没有错误。有什么想法为什么表格不显示在数据中?

TS:

import { Component, OnInit, ChangeDetectorRef } from '@angular/core';

import { NotificationService } from './../../core/services/notification.service';
import { OperationConfiguration } from './../../core/models/operationConfiguration';
import { ProgressBarService } from '../../core/services/progress-bar.service';
import { OperationConfigurationService } from '../../core/services/operation-configuration.service';

@Component({
  selector: 'app-operation-configuration-list',
  templateUrl: './operation-configuration-list.component.html',
  styleUrls: ['./operation-configuration-list.component.css']
})
export class OperationConfigurationListComponent implements OnInit {

  operationConfigurations: OperationConfiguration[];
  columnsToDisplay: ['id', 'columnName', 'hidden'];

  constructor(private progressBarService: ProgressBarService,
    private notificationService: NotificationService,
    private configurationService: OperationConfigurationService) {
    this.progressBarService.show();
  }

  ngOnInit() {
    this.loadOperationConfigurations();
  }

  private loadOperationConfigurations(): void {

    this.configurationService.getAll(null)
      .subscribe(
        results => …
Run Code Online (Sandbox Code Playgroud)

angular-material2 angular

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