小编Aar*_*rsh的帖子

如何在 Windows 启动时添加 mongoDB 服务?

我正在尝试在 Windows 启动时添加 mongoDB 服务,但我仍然无法做到。

每次我必须手动启动 mongoDB 服务。

我研究了如何在 Windows 启动时添加应用程序,但它只启动应用程序而不是这样的服务

在此处输入图片说明

那么你能帮我找到在windows中添加mongoDB服务以使其自动启动的解决方案吗?提前致谢。

windows startup mongodb

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

StateHasChanged 第一次没有检测到变化

似乎StateHasChanged()只有在对 Task 执行 await 操作后才会触发组件的重新渲染(在此处找到)。

所以我只想StateHasChanged用于重新渲染而不是使用Task.delayor Task.Run

这是我的代码:

protected async Task ClearSearch()
        {
            SearchTestCoupon = new Mechanic.Shared.TestCouponSearch();
            IsBusy = true;
            TestCouponGroups = new List<Mechanic.Shared.TestCouponGroup>();
            StateHasChanged();  // << -------- **FIRST TIME** 
            //await Task.Delay(TimeSpan.FromSeconds(1));
            await GetTestCouponGroups(SearchTestCoupon);
        }

 protected async Task GetTestCouponGroups(object args)
        {
                TestCouponGroups = await TestCouponService.GetTestCouponGroupsAsync(SearchTestCoupon);
                IsRowSelected = false;
                IsBusy = false;
                StateHasChanged(); // << -------- **SECOND TIME**
        }
Run Code Online (Sandbox Code Playgroud)

在这里,我使用加载器,它使用IsBusy. 但是StateHasChanged在代码中提到的第一次调用时它不起作用。

但它第二次按预期呈现组件。

我已经使用过,Task.Delay但它破坏了我的其他功能,例如清除网格和显示搜索数据等。

c# rendering blazor

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

ng-pick-date picker:如何设置日期格式?

我想使用选择日期选择器。我想设置日期格式,但不知道该怎么做。那么谁能给我一个例子,说明如何设置日期格式?

这是我的日期选择器的代码:

<label class="control-label my-label">From Date</label>
<div class="input-group">
  <input tabindex="1" class="form-control" [owlDateTime]="fromDateOfConfirmation" [(ngModel)]="fromDate" name="fromDate" [owlDateTimeTrigger]="fromDateOfConfirmation"
   >
  <span class="input-group-addon trigger" [owlDateTimeTrigger]="fromDateOfConfirmation">
    <span class="fa fa-calendar nopad2 fa-lg"></span>
  </span>
  <owl-date-time [pickerType]="'calendar'" #fromDateOfConfirmation></owl-date-time>
</div>
Run Code Online (Sandbox Code Playgroud)

编辑

我已经尝试过了。

export const MY_NATIVE_FORMATS = {
  parseInput: 'LL LT',
  fullPickerInput: 'LL LT',
  datePickerInput: 'LL',
  timePickerInput: 'LT',
  monthYearLabel: 'MMM YYYY',
  dateA11yLabel: 'LL',
  monthYearA11yLabel: 'MMMM YYYY',
};
providers: [
{ provide: OWL_DATE_TIME_FORMATS, useValue: MY_NATIVE_FORMATS },
],
Run Code Online (Sandbox Code Playgroud)

datepicker date-format angular

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

将日期保存到数据库时,parameter.value.getTime 不是函数

我正在将日期从 nodejs 保存到 SQL 数据库。在将日期保存到 SQL 时,我收到错误“parameter.value.getTime”。

以这种格式传递日期,同时将其传递给 SQL。

2018-06-27T18:30:00.000Z
Run Code Online (Sandbox Code Playgroud)

在数据库中的早期记录中,DateTime 格式就是这种格式。

2018-05-25 14:39:19.433
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个错误?我已经使用 moment js 使用另一种格式来保存日期,但它不起作用。

javascript sql datetime node.js angular

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

无法读取未定义的角度 2 的属性“用户名”

我尝试了很多解决方案,但没有一个能帮助我解决这个问题......无法弄清楚我的代码中有什么问题......

HTML 代码 ::

<input type="text" class="form-control"  placeholder="Please Enter Your Username" [(ngModel)]="currentUser.UserName" minlength="3" required id="userNameBox" name="UserName" #uName="ngModel">
Run Code Online (Sandbox Code Playgroud)

组件代码 ::

    profile() {
        let uid = Number(sessionStorage.getItem('id'));
        this._homeService.profile(uid).subscribe(
            res => {
            this.currentUser = res

                console.log(this.currentUser);

});
Run Code Online (Sandbox Code Playgroud)

服务 ::

profile(id: number) {

        return this._http.get(url, id).map(
            (res: Response) => {
                console.log(res.json())
                return new User(res.json()

                ) }
        ).catch(this.handleError);
    }
Run Code Online (Sandbox Code Playgroud)

模型 ::

export class User {

constructor(json: any) {
    if (json != null) {
        this.Id = json.Id;
        this.UserName = json.UserName;
        this.FirstName = json.FirstName;
        this.LastName = json.LastName; …
Run Code Online (Sandbox Code Playgroud)

angular2-forms angular2-template angular2-services angular

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

使用c#以json格式保存数据

我想以这种格式将数据保存在本地 json 文件中:

[
{"Name":"sdafdsf","Password":"dsfads","FirstName":"fsdf","LastName":"dsfdafas"},
{"Name":"sddafdsf","Password":"dsfadds","FirstName":"fdsdf","LastName":"dsfdafasdfs"} 
]
Run Code Online (Sandbox Code Playgroud)

我在控制器中使用它来序列化为 json 格式:

 public ActionResult Index(demo obj)
        {

            String json = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
            string path = Server.MapPath("~/app/");
            //// Write that JSON to txt file,  
            //var read = System.IO.File.ReadAllText(path + "output.json");
            System.IO.File.WriteAllText(path + "output.json",  json);
            return View();
        }
Run Code Online (Sandbox Code Playgroud)

这是我的模型:

public class demo
    {

        public string Name { get; set; }
        public string Password { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
Run Code Online (Sandbox Code Playgroud)

但是我在 output.json 文件中得到了这个,而不是正确的 …

c# json

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