小编sta*_*ons的帖子

将图标与按钮的末尾对齐

您能告诉我在按钮末尾放置图标的正确方法吗?请参阅下面我的代码:

html

<mat-grid-list cols="1" rowHeight="100px">
    <mat-grid-tile [colspan]="1" [rowspan]="1" >
        <div>
            <button mat-raised-button color="primary" flex class="expanded-button" style="text-align: left" [matMenuTriggerFor]="userprofile">
            <span>User Profile</span><mat-icon matSuffix style="float: right; position: relative;">chevron_right</mat-icon>
            </button>
        </div>

        <mat-menu #userprofile="matMenu" xPosition="before">
            <button mat-menu-item>View Profile</button>
            <button mat-menu-item >Change Password</button>
        </mat-menu>
    </mat-grid-tile>
</mat-grid-list>
Run Code Online (Sandbox Code Playgroud)

CSS

.expanded-button {
    display: block;
    width: 190px;
}

.icon-in-menu {
    position: relative;
    margin-right: 5px;
}
Run Code Online (Sandbox Code Playgroud)

通过上面的代码,这就是我得到的:

在此输入图像描述

箭头未与文本对齐。你能帮忙吗?谢谢。

angular-material2

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

在javascript中隐藏我的哈希值

我试图在客户端使用指纹打印,并将此代码作为更大代码的一部分.

function checksum(str) {
    var hash = 5382,
        i = str.length;

    while (i--) hash = (hash * 33) ^ str.charCodeAt(i);

    return hash >>> 0;
}
Run Code Online (Sandbox Code Playgroud)

正如你所看到的那样,哈希很明显.你能告诉我如何使用或者使用什么实现,这样我可以隐藏或任何可以掩盖hash = 5382的东西.谢谢.

javascript

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

在ASP.Net Core中实现ADO连接

我需要从 .Net Core 项目中的数据库获取存储过程。通常我通过这样做来运行这个存储过程:

首选代码

readonly private SqlConnection _dbConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString);

public int Insert(Employee employee)
{
    var result = 0;
    using (var cmd = new SqlCommand("Sp_Insert", _dbConnection) { CommandType = CommandType.StoredProcedure })
    {
        try
        {
            cmd.Parameters.AddWithValue("@FirstName", employee.FirstName);
            cmd.Parameters.AddWithValue("@LastName", employee.LastName);
            cmd.Parameters.AddWithValue("@EmployeeCode", employee.EmployeeCode);
            cmd.Parameters.AddWithValue("@Position", employee.Position);
            cmd.Parameters.AddWithValue("@Office", employee.Office);

            _dbConnection.Open();
            result = cmd.ExecuteNonQuery();
        }
        catch
        {
            // ignore
        }
        finally
        {
            _dbConnection.Close();
        }
    }
    return result;
}
Run Code Online (Sandbox Code Playgroud)

我的连接字符串位于 Web.config 中,但对于 .net Core,我的连接字符串位于 appsettings.json 中,如下所示:

.Net 实体框架代码

{
  "ConnectionStrings": {
    "Default": "server=DESKTOP-98TG6JE\\SERVER_2014;database=vega;user=sa;password=ComplexPassword!123;"
  },
  "Logging": …
Run Code Online (Sandbox Code Playgroud)

c#

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

如何将从数据库中获取的值设置为Angular Material Autocomplete的默认值

我想从数据库中获取一个值,并将其设置为自动完成输入框中的默认值.

填充clientTypes

clientTypes: any[] = [];
getClientTypes() {
    this.clientService.getClientTypes()
    .subscribe((data: any) => {
        this.clientTypes = [...data];
    });
}
Run Code Online (Sandbox Code Playgroud)

用于自动完成显示

displayFn(object): string {
    console.log(object.ClientTypeId);
    return object.Name;
}
Run Code Online (Sandbox Code Playgroud)

在HTML中

<mat-form-field appearance="outline">
    <mat-label>Client Type</mat-label>
    <input type="text" placeholder="Select Client Type" aria-label="Number" matInput formControlName="clienttype"  [formControl]="clientTypeControl" [matAutocomplete]="auto3">
    <mat-autocomplete #auto3="matAutocomplete" [displayWith]="displayFn" (optionSelected)='setClientTypeId($event.option.value)'>
        <mat-option *ngFor="let clientType of clientTypes" [value]="clientType">
            {{ clientType.Name }}
        </mat-option>
    </mat-autocomplete>
</mat-form-field>
<br>
Run Code Online (Sandbox Code Playgroud)

当我使用编辑时,我从数据库中获取保存的accountTypeId.我的问题在于如何将获取的accounTypeId作为默认选项放入matautocomplete中,但仍然可以获得其余的选项?

谢谢.

angular mat-autocomplete

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

将 1 和 0 的数组值转换为二进制

在 Arduino IDE 中,我将所有输入值放入一个数组中,如下所示:

int eOb1 = digitalRead(PrOb1);
int eLoop = digitalRead(PrLoop);
int eOb2 = digitalRead(PrOb2);

InputValues[0] = eOb1;
InputValues[1] = eLoop;
InputValues[2] = eOb2;
InputValues[3] = 0;
InputValues[4] = 0;
InputValues[5] = 0;
InputValues[6] = 0;
InputValues[7] = 0;
Run Code Online (Sandbox Code Playgroud)

我想将其转换为字节数组,如下所示:00000111
你能给我看看吗?我尝试使用 for 循环来迭代这些值,但它不起作用。

char bin[8];
for(int i = 0; i < 8; ++i) {
   bin &= InputValues[i];
}
Run Code Online (Sandbox Code Playgroud)

c++ arduino

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

禁用Ng在Angular 2中不起作用

我在component.html中有这个应该根据我的component.ts中的值启用和禁用,即“ disabledInput”

home.component.html

<div class="input-field">
  <input [attr.disabled]="disabledInput" value="{{userClaims.UserId}}" type="text" class="validate">
</div>
Run Code Online (Sandbox Code Playgroud)

这是'disabledInput'的值是 home.component.ts的地方

disabledInput: boolean = true;
Run Code Online (Sandbox Code Playgroud)

为什么即使将disabledInput更改为false或true,输入字段仍保持禁用状态?在开发控制台中,我可以看到“ disbaled = false”或“ disabled = true”,但输入字段不会更改状态。谢谢。

angular

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

获取angular2中表单的所有值

我可以使用以下代码获取表单的值:

<input type="text" formControlName="subscriptionFormName" id="subscriptionFormName" #UserName class="form-control" mdbInputDirective>
<button class="btn btn-indigo btn-lg btn-block waves-light" type="button" (click)="OnSubmit(UserName.value)" mdbWavesEffect>Send
    <i class="fa fa-paper-plane-o ml-1"></i>
</button>
Run Code Online (Sandbox Code Playgroud)

但是我需要获取表单的所有值,所以我可以这样做:

<button class="btn btn-indigo btn-lg btn-block waves-light" type="button" (click)="OnSubmit(allFormValues)" mdbWavesEffect>Send
    <i class="fa fa-paper-plane-o ml-1"></i>
</button>

user: User;
ObSubmit(values) {
    user.UserName = values.UserName;
    user.Password = values.Password;
    ......
}
Run Code Online (Sandbox Code Playgroud)

下面是完整的代码:

<div class="row">
  <div class="col-md-12 text-left">

    <form [formGroup]="subscriptionForm">
      <h3 style="color: gray; text-align: center;">Registration</h3>

      <div class="row">
        <div class="col-md-6">
          <div class="md-form">
            <i class="fa fa-user prefix grey-text"></i>
            <input type="text" formControlName="UserName" id="UserName" class="form-control" mdbInputDirective>
            <label …
Run Code Online (Sandbox Code Playgroud)

html angular

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

在C#中将十六进制值转换为8位数的字节

我收到"7"的值.使用下面的代码.我得到"111",但我需要的是"0000111",如果我收到"255",我得到"1001010101",但我需要得到的是"11111111".请参阅下面的代码:

_dataRx = ((SerialPort) (sender)).ReadLine();
_dataRx = _dataRx.Replace("\r\n", "").Replace("\r", "").Replace("\n", "");
var x = Convert.ToString(Convert.ToInt32(_dataRx, 16), 2);
Console.WriteLine(x);
Run Code Online (Sandbox Code Playgroud)

我需要总共有8个数字,因为我需要将它放在一个数组中.你能帮忙吗?谢谢.

c#

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

安装离子材料设计

我已经按照将离子材料设计集成到离子项目中的步骤进行了操作.以下是我所做的事情清单:

  1. 离子启动离子材料空白
  2. 凉亭安装离子材料
  3. 凉亭安装robotodraft
  4. 在Ionic index.html页面中添加了JS和CSS库 在此输入图像描述

在第五,它指示将离子材料注入您的离子应用程序,如下所示: var app = angular.module('YOUR_APP_NAME', ['ionic', 'ionic-material']);

我将在哪里以及如何在Ionic项目中注入它?我有app.module.ts和app.component.ts.但是我如何以及在何处插入提到的代码,因为它甚至要求我输入我的应用程序名称angular.module('YOUR_APP_NAME', ['ionic', 'ionic-material']).

ionic-framework ionic-material ionic3 angular

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