小编Mat*_*ijs的帖子

如何使用Angular4按元素id设置焦点

我是Angular的新手,我正在尝试使用它来设置id为"input1"的输入.我使用以下代码:

@ViewChild('input1') inputEl: ElementRef;
Run Code Online (Sandbox Code Playgroud)

然后在组件中:

 this.inputEl.nativeElement.focus();
Run Code Online (Sandbox Code Playgroud)

但它没有用.我究竟做错了什么?任何帮助都感激不尽.

angular angular-forms

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

没有类型'Microsoft.AspNetCore.Identity.UserManager` StudentUser的服务

我的设置

目前,我有两个继承的模型ApplicationUser,这是一种IdentityUser类型.用户类是:

public abstract class ApplicationUser : IdentityUser
{
    [PersonalData]
    public string FirstName { get; set; }

    [PersonalData]
    public string LastName { get; set; }

    [NotMapped]
    public string FullName => $"{FirstName} {LastName}";
}

public class StudentUser : ApplicationUser
{
    [PersonalData]
    [Required]
    public string StudentNumber { get; set; }

    // A user belongs to one group
    public Group Group { get; set; }
}

public class EmployeeUser : ApplicationUser { }
Run Code Online (Sandbox Code Playgroud)

ApplicationUser包含共享属性,如姓氏和名字.在StudentUser …

c# roles entity-framework-core .net-core

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

无法解析程序集或Windows元数据文件'System.Configuration.dll'

我试图在Visual Studio中编译一个小的测试版本.(用C#编写).但是,我在尝试时遇到2个错误,但无法找到问题.没有给出任何一行:

错误1: small_project.csproj

无法解析程序集或Windows元数据文件'System.Configuration.dll'

错误2:

类型Universe无法解析程序集:System.Configuration,Version 2.0.0.0,Culture = neutral,PublicKeyToken ..等.

我是C#和xaml开发的新手.有人知道是什么原因引起的吗?

c# compiler-errors visual-studio-2015

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

Perl重载@ {},以便您可以向foreach()提供对象

有没有一种方法可以使类重载数组取消引用程序,从而可以为该类提供实例,foreach并在每次迭代时运行自定义函数?

我试过了:

  • 重载@{}并将其分配给子。但是,在这种情况下,子仅执行一次,并且应该返回对要迭代的数组的引用。几乎但不是我想要的。

  • 重载<>。每次读取尝试都会执行分配的功能。确实是我想要的方式,但是它可以与while循环一起使用,而不能与一起使用foreach

重载

use overloaded;

$class = overloaded->new();

$class->add("Hi");
$class->add("Hello");
$class->add("Yeet");

foreach $string (@$class) {
    print("NEXT ITEM: ".$string."\n");
}

while ($item = <$class>) {
    print("NEXT ITEM: ".$item."\n");
}
Run Code Online (Sandbox Code Playgroud)

超载

package overloaded;

use strict;
use warnings;
use Data::Dumper;
use overload '@{}' => \&next, '<>' => \&fetchNext;

sub new {
    my ($class, %args) = @_;
    $args{fields} = ();
    $args{pos} = 0;
    return bless { %args }, $class;
}

sub add …
Run Code Online (Sandbox Code Playgroud)

perl operator-overloading

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

adb.exe问题

我对Android Studio 3.4的adb.exe有问题。

运行模拟器时,出现以下错误:

模拟器:模拟器:错误:AdbHostServer.cpp:93:无法连接到端口5037上的adb守护程序

我打开了adb.exe的终端: C:\Users\Christian\AppData\Local\Android\Sdk\platform-tools

在这里,我尝试使用adb kill-server,然后使用adb start-server,得到的是:

*daemon not running; starting now at tcp:5037
*daemon started successfully
Run Code Online (Sandbox Code Playgroud)

当我再次运行时,出现相同的错误,我在终端中使用命令adb devices看到此错误:

List of devices attached
emulator-5554   offline
Run Code Online (Sandbox Code Playgroud)

我使用系统映像来模拟Nexus 5X API 28:Pie 28 x86 Android 9.0。

我在Windows中下载了最新版本的abd.exe

我还重新安装了Android Studio和仿真器,但错误仍然出现。

我该如何解决?

android adb android-emulator

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

PhpStorm - 防止数组括号对齐

PhpStorm 正在对齐数组中的括号。

DB::table('something')->create([
                                   'title' => 'John',
                                   'description' => 'Doe',
                               ]); // I don't want to align it this way...


DB::table('something')->create([
    'title' => 'John',
    'description' => 'Doe',
]); // But this way...
Run Code Online (Sandbox Code Playgroud)

我在哪里改变这个Settings/Preferences > Editor > Code Style > PHP

php phpstorm

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

如何将按钮添加到导航抽屉菜单?

我想在我的导航抽屉菜单中添加一个按钮,如下所示:

想要的结果

图片:想要的结果

我尝试使用 actionLayout 参数实现这一点,但我似乎只能使用右侧的一些空间,而不是整个宽度:

当前结果

图片:当前结果

标题似乎占据了左侧的空间。但我想添加一个全宽的按钮,就像第一张图片一样。

我目前的代码:

...

<item
                    android:id="@+id/nav_login"
                    android:title=""
                    app:actionLayout="@layout/button_login"
                    app:showAsAction="ifRoom"/>

...
Run Code Online (Sandbox Code Playgroud)

button_login.xml

<?xml version="1.0" encoding="utf-8"?>
<Button xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:background="#0000ff"
    android:text="Login"
    android:textColor="#ffffff"
    android:layout_height="match_parent" />
Run Code Online (Sandbox Code Playgroud)

layout android menu navigation-drawer

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

Ionic 3-键盘无缘无故地将内容推到其他内容之上

我正在用Ionic开发一个简单的应用程序。

我有一个问题,就是键盘将我的输入字段向上推到另一个div上,同时又有足够的空间供他们键盘输入。我该如何解决?我已经在互联网上四处张望,但是找不到解决我问题的方法。

这是发生了什么:

应用程式

如您所见,文本在图像中,因此没有理由如此之高。下面有足够的空间。

这是我的代码:

HTML:

<ion-header>

  <ion-navbar>
    <ion-title>Login</ion-title>
  </ion-navbar>

</ion-header>


<ion-content padding class="login content">

  <div class="logo-container">
      <img src="assets/imgs/Mikos_logo.jpeg" class="logo-img">
  </div>

  <div class="center">
      <p>Vul hier je naam in:</p>
      <ion-item class="code-field">
          <ion-input placeholder="naam" type="text" (keyup)="nameInput()" [(ngModel)]="name"></ion-input>
      </ion-item>      
  </div>



</ion-content>
Run Code Online (Sandbox Code Playgroud)

CSS:

page-login {

    .login {
        background-color: #EEEEEE;
    }

    .logo-container{
        position: absolute;
        width: 400px;
        left: calc(50% - 400px / 2);
      }

      .logo-img{
        display: block;
        width: 100%;
        height: auto;
      }

    .center{
        position: absolute;
        top: 40%;
        width: 300px;
        left: calc(50% - 300px / 2);
    } …
Run Code Online (Sandbox Code Playgroud)

ionic-framework ionic3

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

如何修复在模块class.jar中找到的此错误重复类

当我尝试为项目生成签名的APK时出现此错误

在模块classes.jar(com.google.android.gms:play-services-measurement-impl:16.5.0)和classes.jar(com.google.firebase)中找到重复的com.google.android.gms.measurement.AppMeasurement类:firebase-analytics-impl:10.0.1)重复的模块com.google.firebase.analytics.FirebaseAnalytics类在模块classes.jar(com.google.android.gms:play-services-measurement-api:16.5.0)和classes.jar(com.google.firebase:firebase-analytics-impl:10.0.1)重复的类com.google.firebase.analytics.FirebaseAnalytics $ Event在模块classes.jar(com.google.android.gms:play- services-measurement-api:16.5.0)和classes.jar(com.google.firebase:firebase-analytics-impl:10.0.1)重复的类com.google.firebase.analytics.FirebaseAnalytics $ Param位于模块classes.jar中(com.google.android.gms:play-services-measurement-api:16.5.0)和classes.jar(com.google.firebase:firebase-analytics-impl:10.0.1)重复的类com.google.firebase.analytics.FirebaseAnalytics $ UserProperty在模块类中找到.jar(com.google.android.gms:play-services-measurement-api:16.5.0)和classes.jar(com.google.firebase:firebase-analytics-impl:10.0.1)

转到文档以了解如何修复依赖性解析错误。

我如何解决它?

build.gradle

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

ASP NET CORE - ANGULAR NO'Access-Control-Allow-Origin'标头出现在请求的资源上

可能会多次询问此问题,但在线提供的解决方案对我不起作用.

在我们的项目中,我们使用WebMethod作为Asp.Net页面处理数据库,或者如果我这样说,我们有一个WebApi: -

HTTP://server/Pages/ApplicationData.aspx/GetApplicationLookups

现在我们有一个AspNet Core Angular Web应用程序,它调用了这个API

postgetGetApplicationLookups(url: string) {
    var headers = new Headers();
    headers.set('Accept', 'application/json; charset=utf-8');
    headers.set('content-Type', 'application/json; charset=utf-8');
    let data = {};
    debugger;
    return this.http.post(
        url,
        data,
        { headers: headers }
    )
        .map(this.handleSuccess)
        .catch(this.handleError)
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误: - 在此输入图像描述

如果我使用POSTMAN,这个POST调用工作正常: -

在此输入图像描述

我使用以下代码修改了我的Startup.cs但我仍然得到相同的错误.

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

    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddCors(options => options.AddPolicy("AllowAll", p => p.AllowAnyOrigin()           //Fix API ISSUE
                                                                    .AllowAnyMethod()               //Fix API ISSUE
                                                                     .AllowAnyHeader()));           //Fix API ISSUE …
Run Code Online (Sandbox Code Playgroud)

asp.net-core-mvc asp.net-core angular

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