我在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 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) 我已将我的 .NET core 3.1+Angular 9.1 更新为 Angular 10.0.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
我试图在不更改按钮大小的情况下包装或调整引导按钮内的文本.我有几个必须对齐的按钮
我已经使用过这个类,文本是换行但是按钮的大小会增加,影响与其他按钮的对齐
.btn-wrap-text {
white-space: normal !important;
word-wrap: break-word !important;
}
Run Code Online (Sandbox Code Playgroud)
有示例代码,只需调整视图大小:https: //jsfiddle.net/mrapi/3yv314dx/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
我正在使用 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)
但是如何在上下文类中访问它?谢谢
我正在尝试将我的项目从 .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) 我已经将应用程序从Angular 4.2升级到5,但是出现了这个错误:
unhandled exception occurred while processing the request
更具体地说:
NodeInvocationException:没有PlatformRef的提供者!错误:没有PlatformRef的提供程序!at injectionError(e:\ myapp\ClientApp\dist\vendor.js:12066:90)
该应用程序还使用webpack和ASP.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,该应用程序工作正常,我的思路中是否有任何错误的做法?
我已经升级,从角4.2应用5,但更改后Http
到HttpClient
了对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) 我有一个运行良好的项目,但在最新的 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)
谢谢
有了最新的更新,我得到了这个:
警告:参数“更新”是必需的。. (missing_required_param 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)
谢谢
angular ×5
asp.net-core ×4
flutter ×3
.net-core ×2
dart ×2
node.js ×2
typescript ×2
android ×1
angular-cli ×1
angular5 ×1
c# ×1
css ×1
emulation ×1
html ×1
javascript ×1
npm ×1
nuget ×1