小编Sim*_*Ged的帖子

在2个模块之间共享组件

我正在尝试包含一个Component2个模块(父级和子级),但在此过程中会遇到各种错误

app.module.ts

@NgModule({
    declarations: [SharedComponent],
    exports: [SharedComponent]...
})    
Run Code Online (Sandbox Code Playgroud)

child.module.ts

@NgModule({
    imports: [SharedComponent], //Unexpected directive imported by module
})  
Run Code Online (Sandbox Code Playgroud)

app.html

<div class="container">
    <shared-selector></shared-selector>
    <child-selector></child-selector>
</div>
Run Code Online (Sandbox Code Playgroud)

child.html

<div>
    content
    <shared-selector></shared-selector>
</div>
Run Code Online (Sandbox Code Playgroud)

我正在Async中加载ChildModule

loadChildren: 'app/child.module#ChildModule',
Run Code Online (Sandbox Code Playgroud)

当没有importingdeclaringChildModule我收到错误时:

template parse error: shared-selector is not a known element
Run Code Online (Sandbox Code Playgroud)

******更新*******

在创建时FeatureModule,为了工作SharedModule应该导出组件...更新代码...

SharedModule

@NgModule({
    imports: [
        CommonModule
     ],
    declarations: [
         SharedComponent
    ],
    exports: [
        SharedComponent
    ]
})

export class SharedModule {}
Run Code Online (Sandbox Code Playgroud)

app.module.ts

@NgModule({ …
Run Code Online (Sandbox Code Playgroud)

angular

40
推荐指数
3
解决办法
5万
查看次数

条件绑定的初始化程序必须具有Optional类型,而不是'String'

这是我在更新后遇到的一个有趣的问题 Swift 2.0

错误就if let url = URL.absoluteString行了

func myFormatCompanyMessageText(attributedString: NSMutableAttributedString) -> NSMutableAttributedString
{
    // Define text font
    attributedString.addAttribute(NSFontAttributeName, value: UIFont(name: "Montserrat-Light", size: 17)!, range: NSMakeRange(0, attributedString.length))

    return attributedString
}

func textView(textView: UITextView, shouldInteractWithURL URL: NSURL, inRange characterRange: NSRange) -> Bool {
    if let url = URL.absoluteString {
        if #available(iOS 8.0, *) {
            VPMainViewController.showCompanyMessageWebView(url)
        }
    }
    return false
}
Run Code Online (Sandbox Code Playgroud)

nsurl swift swift2

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

React Native Android运行会导致"updateHotspot命令的参数数量非法"

我创建使用简单的应用程序React Native两个iOSAndroid.我已经对这两个平台进行了一段时间的测试,并且一切运行良好.但最近,我一直在关注,iOS到目前为止我的所有功能都完美无缺.但是当我尝试它时Android; 特别是当我尝试将项添加到我现有的本地数据时,AsyncStorage它给出了以下错误:

illegal number of arguments for updateHotspot command
Run Code Online (Sandbox Code Playgroud)

我的应用程序还有其他功能,广告项目使用AsyncStorage没有问题.但是一切都运行良好iOS.

我正在使用Genymotion(试用版)在Android平台上测试它.

我试图从互联网上搜索但没有发现任何东西.在我看来这是Java件好事.

更新:

我不再使用Genymotion(试用版已过期),而是这次只是来自Android Studio的模拟器.

这是我收到的错误:

在此输入图像描述

java android react-native

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

Angular 6在"e2e/app"文件夹中生成服务

我最近将角度4升级到6.现在我尝试了下面的命令

ng generate service security/security
Run Code Online (Sandbox Code Playgroud)

但它在"e2e/app"文件夹下创建了服务,而不是在"src/app"下面是我的angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "xyz": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/style.scss",
              "src/styles.css"
            ],
            "scripts": [
            ]
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [ …
Run Code Online (Sandbox Code Playgroud)

angular angular6

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

为什么在Pandas Series上调用.sort()函数就地对其值进行排序并且什么都不返回?

对不起我觉得我遗漏了一些非常基本的东西:

>>> Series([3,4,0,3]).sort()
Run Code Online (Sandbox Code Playgroud)

输出无,而

>>> Series([3,4,0,3]).order()
2    0
0    3
3    3
1    4
dtype: int64
Run Code Online (Sandbox Code Playgroud)

sort()我缺少什么?

谢谢

编辑:

谢谢你的回答,我现在意识到这是在排序.但我不明白为什么

>>> s = Series([3,4,0,3]).sort()
>>> s
Run Code Online (Sandbox Code Playgroud)

不返回已排序的系列.如果我理解手册,它应该返回按顺序排列的系列.

python python-3.x pandas

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

错误 NETSDK1032:RuntimeIdentifier 平台“win-x86”和 PlatformTarget“x64”必须兼容

我的解决方案是:

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core31ConsoleApp", "Core31ConsoleApp\Core31ConsoleApp.csproj", "{06477443-295A-47CA-A36E-A3F6B3AE47AC}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|x64 = Debug|x64
        Debug|x86 = Debug|x86
        Release|x64 = Release|x64
        Release|x86 = Release|x86
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {06477443-295A-47CA-A36E-A3F6B3AE47AC}.Debug|x64.ActiveCfg = Debug|x64
        {06477443-295A-47CA-A36E-A3F6B3AE47AC}.Debug|x64.Build.0 = Debug|x64
        {06477443-295A-47CA-A36E-A3F6B3AE47AC}.Debug|x86.ActiveCfg = Debug|x86
        {06477443-295A-47CA-A36E-A3F6B3AE47AC}.Debug|x86.Build.0 = Debug|x86
        {06477443-295A-47CA-A36E-A3F6B3AE47AC}.Release|x64.ActiveCfg = Release|x64
        {06477443-295A-47CA-A36E-A3F6B3AE47AC}.Release|x64.Build.0 = Release|x64
        {06477443-295A-47CA-A36E-A3F6B3AE47AC}.Release|x86.ActiveCfg = Release|x86
        {06477443-295A-47CA-A36E-A3F6B3AE47AC}.Release|x86.Build.0 = Release|x86
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = …
Run Code Online (Sandbox Code Playgroud)

.net-core

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

将 redux 工具包与 typescript 结合使用时,参数“state”隐式出现“any”类型错误

我将 redux-toolkit 与 typescript 一起使用,但减速器中的状态始终具有 any 类型,并且会出现错误。

 [export const counterSlice = createSlice({
  name: "counter",
  initialState,
  // The `reducers` field lets us define reducers and generate associated actions
  reducers: {
    increment: (state) => {
      // Redux Toolkit allows us to write "mutating" logic in reducers. It
      // doesn't actually mutate the state because it uses the Immer library,
      // which detects changes to a "draft state" and produces a brand new
      // immutable state based off those changes
      state.value += 1; …
Run Code Online (Sandbox Code Playgroud)

typescript react-redux redux-toolkit

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

IAsyncEnumerable 中缺少等待运算符时的警告消息

当调用这样的方法而不执行await任务时,我们可以返回以下内容:

public Task<bool> GetBoolAsync()
{
    return Task.FromResult(true);
}
Run Code Online (Sandbox Code Playgroud)

a 相当于什么IAsyncEnumerable<>并避免警告。

async IAsyncEnumerable<bool> GetBoolsAsync() // <- Ugly warning
{
    yield return true;
    yield break;
}
Run Code Online (Sandbox Code Playgroud)

警告 CS1998 此异步方法缺少“await”运算符,并将同步运行。考虑使用“await”运算符等待非阻塞 API 调用,或使用“await Task.Run(...)”在后台线程上执行 CPU 密集型工作。

c# async-await iasyncenumerable

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

在ASP.NET Core 2.1中使用Cookie

我有一个简单的ASP.NET Core 2.1应用程序,该应用程序应该设置然后读取Cookie。

每当我尝试读取Cookie时,它都会返回null。在浏览器的检查工具中进一步查找,我找不到它。

我想出了一个小小的实现,以查看是否可以弄清发生了什么,但是它不起作用。

 public async Task<IActionResult> Contact(Contato contato)
 {
    await email.SendAsync(contato);

    var option = new CookieOptions();
    option.Expires = DateTime.Now.AddMinutes(10);
    Response.Cookies.Append("EmailEnviado", "true", option);
    var boh = Request.Cookies["EmailEnviado"];

    return RedirectToAction("Contact");
 }
Run Code Online (Sandbox Code Playgroud)

boh通过调试器检查的变量为null,即使它是在前一行中编写的也是如此。

html c# asp.net-mvc asp.net-core

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

ASP.NET Core:OpenIdConnect:message.State 为 null 或为空

我收到此错误:

OpenIdConnectAuthenticationHandler:message.State 为 null 或为空。

与 URL https://localhost:7208/home/index,但身份验证使用 url https://localhost:7208/

谁能帮助我理解这一点?

在此输入图像描述

在此输入图像描述

这是我的代码:

Program.cs

using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using System.Security.Claims;
using System.Web.Mvc;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddMvc().AddSessionStateTempDataProvider();
builder.Services.Configure<CookieAuthenticationOptions>(CookieAuthenticationDefaults.AuthenticationScheme, options =>
{

});
builder.Services.AddAuthentication(options =>
{
    options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;

}).AddCookie(options =>
{

})
.AddOpenIdConnect(options =>
{
    options.Authority = builder.Configuration["OpenIdConfigurations:Authority"];
    options.MetadataAddress = builder.Configuration["OpenIdConfigurations:MetadataAddress"];
    options.ResponseType = builder.Configuration["OpenIdConfigurations:ResponseType"];
    options.GetClaimsFromUserInfoEndpoint = Convert.ToBoolean(builder.Configuration["OpenIdConfigurations:GetClaimsFromUserInfoEndpoint"]);
    options.RequireHttpsMetadata = Convert.ToBoolean(builder.Configuration["OpenIdConfigurations:RequireHttpsMetadata"]);
    options.ClientId = builder.Configuration["OpenIdConfigurations:ClientId"];
    options.ClientSecret = builder.Configuration["OpenIdConfigurations:ClientSecret"];
    options.CallbackPath = …
Run Code Online (Sandbox Code Playgroud)

openid-connect asp.net-core asp.net-core-webapi

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