小编mra*_*api的帖子

Angular 4:没有找到组件工厂,你是否将它添加到@ NgModule.entryComponents?

我在webpack中使用Angular 4模板,当我尝试使用组件时会出现此错误(ConfirmComponent):

找不到ConfirmComponent的组件工厂.你有没有把它添加到@ NgModule.entryComponents?

组件在app.module.server.ts中声明

@NgModule({
  bootstrap: [ AppComponent ],
  imports: [
    // ...
  ],
  entryComponents: [
    ConfirmComponent,
  ],
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

我还有app.module.browser.ts和app.module.shared.ts

如何解决这个问题.谢谢

angular angular-webpack-starter

231
推荐指数
13
解决办法
23万
查看次数

更新 angular-devkit 并失败:Microsoft.AspNetCore.SpaServices[0]

在我的 Angular 8 +.net core 2.2 中,我从 Angular 8.2.1 升级到 8.2.7,之后我在控制台窗口中看到消息:

fail: Microsoft.AspNetCore.SpaServices[0]
      <s> [webpack.Progress] 10% building 1/1 modules 0 active
.......................
fail: Microsoft.AspNetCore.SpaServices[0]
      <s> [webpack.Progress] 98% after emitting

fail: Microsoft.AspNetCore.SpaServices[0]
      <s> [webpack.Progress] 98% after emitting CopyPlugin

fail: Microsoft.AspNetCore.SpaServices[0]
      <s> [webpack.Progress] 98% after emitting angular-compiler

fail: Microsoft.AspNetCore.SpaServices[0]
      <s> [webpack.Progress] 98% after emitting SizeLimitsPlugin

fail: Microsoft.AspNetCore.SpaServices[0]
      <s> [webpack.Progress] 100%

info: Microsoft.AspNetCore.SpaServices[0]
      chunk {main} main.js, main.js.map (main) 451 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 287 kB [initial] [rendered]
chunk {polyfills-es5} …
Run Code Online (Sandbox Code Playgroud)

javascript node.js typescript asp.net-core angular

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

将 ng cli 更新到版本 10 后,VS 2019 没有智能感知和验证

我已将我的 .NET core 3.1+Angular 9.1 更新为 Angular 10.0.2,我使用的步骤:

  1. 将 Vs TypeScript 更新为3.9.5
  2. ng update @angular/core @angular/cli

之后 VS 2019 v 16.6.3 没有显示智能感知和验证,项目运行没有问题。如果我在 VS Code 中打开项目一切正常

我发现问题就在我跑完之后 ng update @angular/cli

将项目恢复到 9.1 一切正常

谢谢

visual-studio typescript angular-cli angular visual-studio-2019

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

如何在不改变按钮大小的情况下将文本包装在bootstrap按钮中?

我试图在不更改按钮大小的情况下包装或调整引导按钮内的文本.我有几个必须对齐的按钮

我已经使用过这个类,文本是换行但是按钮的大小会增加,影响与其他按钮的对齐

 .btn-wrap-text {
    white-space: normal !important;
    word-wrap: break-word !important;
}
Run Code Online (Sandbox Code Playgroud)

有示例代码,只需调整视图大小:https: //jsfiddle.net/mrapi/3yv314dx/1/

谢谢

html css twitter-bootstrap twitter-bootstrap-3

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

NuGet.targets 错误:'.',十六进制值 0x00,是升级到 .Net Core 2.1.1 后的无效字符

升级到 .Net Core 2.1.1 后,我收到此错误:

  C:\Program Files\dotnet\sdk\2.1.301\NuGet.targets(114,5): error : An error 
occurred while retrieving package metadata for 'System.IO.4.3.0' from source
     'C:\Program Files\dotnet\sdk\NuGetFallbackFolder'. 
    C:\Program Files\dotnet\sdk\2.1.301\NuGet.targets(114,5): error :   '.', 
hexadecimal value 0x00, is an invalid character. Line 1, position 1. 
Run Code Online (Sandbox Code Playgroud)

无法解决它使用

nuget.exe locals -clear global-packages
nuget.exe locals -clear packages-cache
nuget.exe locals -clear http-cache
Run Code Online (Sandbox Code Playgroud)

或者

nuget.exe locals -clear all
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助

nuget nuget-package nuget-package-restore .net-core asp.net-core

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

如何访问 DbContext 类中的配置?

我正在使用 ASP.NET Core 2 我正在尝试访问上下文类中的配置,我已经完成了这样的配置:在 Program.cs 中:

 public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
        ......
             .ConfigureAppConfiguration((builderContext, config) =>
             {
                 IHostingEnvironment env = builderContext.HostingEnvironment;

                 config.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                       .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
             })

           .Build();
Run Code Online (Sandbox Code Playgroud)

在 Startup.cs 中:

 public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }
Run Code Online (Sandbox Code Playgroud)

我可以在这样的控制器中访问它:

public HomeController(IConfiguration configuration)
   {...}
Run Code Online (Sandbox Code Playgroud)

但是如何在上下文类中访问它?谢谢

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

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

无法在 EF 核心 3.1 查询中使用 .AddDays

我正在尝试将我的项目从 .net core 2.2 迁移到 3.1,以下代码运行良好,但现在给出了该错误:

System.InvalidOperationException: LINQ 表达式 'DbSet .Where(h => h.DATAI.AddDays((double)Convert.ToInt32((object)h.NRZILE)) >= __date_0 && h.DATAI.AddDays((double)Convert .ToInt32((object)h.NRZILE)) < __AddDays_1 || h.DATAI <= __AddDays_1 && h.DATAI.AddDays((double)Convert.ToInt32((object)h.NRZILE)) >= __AddDays_1)' 不能被翻译。以可翻译的形式重写查询,或通过插入对 AsEnumerable()、AsAsyncEnumerable()、ToList() 或 ToListAsync() 的调用显式切换到客户端评估。

public async Task<IActionResult> getOp(int day, int month, int year, int daysToShow)
    {
    var date = new DateTime(year, month, day);

    return Ok(await db.HT_REZ
    .Where(r => (r.DATAI.AddDays(Convert.ToInt32(r.NRZILE)) >= date && r.DATAI.AddDays(Convert.ToInt32(r.NRZILE)) < date.AddDays(daysToShow))
     || (r.DATAI <= date.AddDays(daysToShow) &&  r.DATAI.AddDays(Convert.ToInt32(r.NRZILE)) >= date.AddDays(daysToShow))
    )
    .Select(r => new { r.ID,  .... }) …
Run Code Online (Sandbox Code Playgroud)

entity-framework-core .net-core

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

Android模拟器字体平滑

可以更改 Adndoid 模拟器的字体平滑吗?我有一个运行良好的 Flutter 项目,几个月后我重新打开,更新了 Android Studio/模拟器/Flutter 并得到了丑陋的显示

谢谢

在此输入图像描述

android emulation android-emulator flutter

5
推荐指数
0
解决办法
284
查看次数

从Angular 4升级到5:"NodeInvocationException:没有PlatformRef的提供者!"

我已经将应用程序从Angular 4.2升级到5,但是出现了这个错误: unhandled exception occurred while processing the request更具体地说:

NodeInvocationException:没有PlatformRef的提供者!错误:没有PlatformRef的提供程序!at injectionError(e:\ myapp\ClientApp\dist\vendor.js:12066:90)

该应用程序还使用webpackASP.NET Core.

我安装了node v9.1,和typescript 2.6.1.

我也package.json用命令更新了:

npm install @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest @angular/animations@latest typescript@latest 
Run Code Online (Sandbox Code Playgroud)

然后,运行以下内容:

 npm install --save-dev @ngtools/webpack@latest
Run Code Online (Sandbox Code Playgroud)

我也用过HttpClient而不是Http:

import { HttpClient } from '@angular/common/http'; 
.....
 getThings() {
        return this.http.get('/api/things');

  }
Run Code Online (Sandbox Code Playgroud)

如果我降级回Angular 4,该应用程序工作正常,我的思路中是否有任何错误的做法?

node.js npm asp.net-core angular angular5

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

在Angular 5中将Http升级到HttpClient:“服务器的响应状态为415(不受支持的媒体类型)”

我已经升级,从角4.2应用5,但更改后HttpHttpClient了对POST请求的错误:

错误,服务器响应状态为415(不支持的媒体类型)

app.module我已经导入HttpClientModule

import { HttpClientModule } from '@angular/common/http';
Run Code Online (Sandbox Code Playgroud)

旧代码:

 post(url: string, model: any): Observable<any> {
        let body = JSON.stringify(model);
        let headers = new Headers({ 'Content-Type': 'application/json' });
        let options = new RequestOptions({ headers: headers });
        return this._http.post(url, body, options)
            .map((response: Response) => <any>response.json())
            .catch(this.handleError);
    }
Run Code Online (Sandbox Code Playgroud)

新代码:

put(url: string, id: number, model: any): Observable<any> {
        let body = JSON.stringify(model);
        let headers = new Headers({ 'Content-Type': 'application/json' });
        let options: any = new …
Run Code Online (Sandbox Code Playgroud)

angular2-http angular angular-httpclient

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

导航器没有要替换的活动路线

我有一个运行良好的项目,但在最新的 flutter core 更新之后却没有,我得到了:

E/flutter (4510): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] 未处理的异常:'package:flutter/src/widgets/navigator.dart':断言失败:第 3582 行 pos 12:'_history .any(_RouteEntry.isPresentPredicate)':导航器没有要替换的活动路由。E/flutter (4510): #0
_AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39) E/flutter (4510): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart: 36:5)

  Future<void> _submit() async {
    if (!_formKey.currentState.validate()) {
      return;
    }
    _formKey.currentState.save();

    final pref = await SharedPreferences.getInstance();
    pref.setString('ip', _ip);
    pref.setBool('isTablet', isTablet);
   pref.setBool('setting1', isActivated);

     
// error on next part of the code

      Navigator.of(context).pop(); 
      Navigator.of(context).pushReplacementNamed('/');

      Provider.of<Auth>(context, listen: false).logout();
  }
Run Code Online (Sandbox Code Playgroud)

谢谢

dart flutter

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

Flutter ChangeNotifierProvider 需要参数“更新”

有了最新的更新,我得到了这个:

警告:参数“更新”是必需的。. (missing_required_pa​​ram at [pos_mobile] lib\main.dart)

 return MultiProvider(
        providers: [
          ChangeNotifierProvider.value(
            value: Auth(),
          ),
          ChangeNotifierProxyProvider<Auth, Operatori>( // here I got the warning
            builder: (ctx, auth, prevData) => Operatori(auth.token, auth.userId,
                prevData == null ? [] : prevData.operatori),
          ),
Run Code Online (Sandbox Code Playgroud)

谢谢

dart flutter

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