我在新的 angular 项目设置中遇到以下错误。
错误 错误:未捕获(承诺):错误:您的应用程序或其依赖项之一似乎正在使用 i18n。Angular 9 引入了一个
$localize()需要加载的全局函数。请添加import '@angular/localize';到您的 polyfills.ts 文件中。错误:您的应用程序或其依赖项之一似乎正在使用 i18n。Angular 9 引入了一个$localize()需要加载的全局函数。
注意:我来自以下。它建议回退到旧版本。 https://github.com/angular/angular/issues/32508
我有一个对外部日志组件的引用(在 js 文件中引用),我在typings 文件中定义了它
打字.d.ts
declare var LogglyTracker;
Run Code Online (Sandbox Code Playgroud)
我已将 angular 应用程序从版本 8 升级到 9,现在当我运行ng build 时,出现以下错误
src/app/error/loggly.service.ts:13:29 中的错误 - 错误 TS2304:找不到名称“LogglyTracker”。
有谁知道解决这个问题的推荐方法是什么?这段代码在 Angular 8 中运行良好。
@Injectable()
export class LogglyLoggerService {
// https://github.com/loggly/loggly-jslogger
private loggly: any = new LogglyTracker(); //!! Error here
}
Run Code Online (Sandbox Code Playgroud) 我使用 ng-bootstrap 以 angular 开始了我的第一个项目,并按照安装过程进行了操作,但是它不起作用。
该消息是“未捕获的错误:您的应用程序或其依赖项之一似乎正在使用i18n.
Angular 9 引入了一个$localize()需要加载的全局函数。请添加import '@angular/localize';到您的 polyfills.ts 文件中。”
然后我在 polyfill.ts 中添加了这一行
import '@angular/localize';
Run Code Online (Sandbox Code Playgroud)
现在消息变成了
未找到 ./src/polyfills.ts 模块中的错误:错误:无法解析“D:\source\mh\Reclamos-v2\src”中的“@angular/localize”
我应该安装什么?本地化库的名称是什么?
I'm using npm install -g yo gulp to install yeoman and this is the error I'm getting
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Usr\local\gulp -> C:\Usr\local\node_modules\gulp\bin\gulp.js
C:\Usr\local\yo -> C:\Usr\local\node_modules\yo\lib\cli.js
C:\Usr\local\yo-complete -> C:\Usr\local\node_modules\yo\lib\completion\index.js
> yo@3.1.0 postinstall C:\Usr\local\node_modules\yo
> yodoctor
Yeoman Doctor
Running sanity checks on your system
? No .bowerrc file in home directory
? Global configuration file is valid
? NODE_PATH matches the npm root
? No .yo-rc.json file in home directory …Run Code Online (Sandbox Code Playgroud) 我必须在路由器插座上设置路由器动画。实际上,我要动画的只是一个路由。这是我的路由模块:
export class CustomReuseStrategy extends RouteReuseStrategy {
...
...
public shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {
return curr.component ? (<any>curr.component).name !== 'CardDetailComponent' : true;
}
}
const wallRoutes: Routes = [
{
path: 'wall',
component: WrapperComponent,
children: [
{ path: '', component: CardListComponent },
{
path: 'placeslist/:idPlacesList/details/:id',
component: CardDetailComponent,
canActivate: [CardDetailsGuard],
data: {
state: 'details',
reuse: false
}
},
{
path: 'placeslist/:id',
component: PlaceslistDetailComponent,
canActivate: [PlacesListDetailsGuard],
data: {
reuse: true
}
},
{
path: 'details/:id',
component: CardDetailComponent,
canActivate: [CardDetailsGuard],
data: …Run Code Online (Sandbox Code Playgroud) 我创建了一个Azure函数,我们知道它有Microsoft.NET.Sdk.Functions 1.0.8包,它依赖于Newtonsoft.Json 9.0.1.
我添加了另一个类库作为此Azure函数的引用,该函数依赖于Newtonsoft.Json 11.0.2.
在运行时,我收到一条错误,指出"FileNotFoundException:无法加载文件或程序集'Newtonsoft.Json,Version = 11.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'或其中一个依赖项.系统找不到指定的文件. "
这看起来像是与程序集绑定重定向相关的问题所以我按照此解决方案尝试并修复 https://codopia.wordpress.com/2017/07/21/how-to-fix-the-assembly-binding-redirect-problem -in-azure-functions / 但是,这也无济于事.
对于这种情况,是否有一个我缺少的步骤或任何其他解决方法?感谢帮助.
我只是想练习Javascript,所以我尝试这个简单的代码.在我的预期,输出应该是整个列表.
当我使用这段代码时,我只能输出[5,9,17,14,4,19,11,8,13,10,18,15,16,20]
我不知道发生了什么,[1,0,2,3,6,7,12 ...]
[5, 9, 17, 14, 4, 19, 11, 8, 13, 10, 18, 15, 16, 20]
Run Code Online (Sandbox Code Playgroud)
我目前正在使用 Storybook 和 Angular。我似乎无法在我的组件之一中更改 Observable 的值。故事书上没有显示任何内容。
我尝试使用 of(true) 来更改值,但即使没有它,它似乎也不起作用。尝试检查元素但什么也没有,所以我认为它没有做任何事情。
我的故事:
stories.add('Loader', () => {
return {
template: `
<rpg-loader>
</rpg-loader>
`,
props: {
isLoading$: boolean('isLoading$', of(true))
}
};
});
Run Code Online (Sandbox Code Playgroud)
我的组件:
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
selector: 'rpg-loader',
templateUrl: './loader.html',
styleUrls: ['./loader.scss']
})
export class LoaderComponent implements OnInit {
isLoading$: Observable<boolean>;
constructor(
private loadingProvider: LoadingProvider
) { }
ngOnInit() {
this.isLoading$ = this.loadingProvider.getLoadingState();
}
}
Run Code Online (Sandbox Code Playgroud)
我希望故事书向我展示实际的组件,并且我可以在旋钮内切换它,但什么也没有。
我试图在没有构建方法的自定义类中获取颤动的屏幕大小。如何在不使用 buildcontext 类的情况下获得屏幕大小?
以下代码:
class ShapesPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
BuildContext context;
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
final paint = Paint();
paint.color = Colors.deepOrange;
var center = Offset(size.width / 2, size.height / 2);
print(height);
print(width);
Rect rect = Rect.fromLTWH(0.0, 0.0, width, height);
canvas.drawRect(rect, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
给出以下错误:
在paint()期间抛出以下断言:'package:flutter/src/widgets/media_query.dart':失败的断言:第689行pos 12:'context != null':不是真的。
请建议我。我正在学习 Selenium WebDriver 工具并尝试在 Firefox 窗口中运行一些测试,但第二次测试总是失败。我怎样才能避免这种情况?
\n\nGecko 驱动程序:v0.25.0-win32;
\n\n硒:3.141.59;
\n\n框架:JUnit;
\n\n火狐:69.0
\n\n我尝试了隐式等待和显式等待,但没有帮助。
\n\n我的通用 TestBase java 类:
\n\npublic class TestBase {\n\n public static WebDriver driver;\n public static WebDriverWait wait;\n\n @Before\n public void start() {\n if (driver !=null){\n return;\n }\n\n DesiredCapabilities caps = new DesiredCapabilities();\n //caps.setCapability(FirefoxDriver.MARIONETTE, false);\n driver = new FirefoxDriver(caps);\n System.out.println(((HasCapabilities) driver).getCapabilities());\n wait = new WebDriverWait(driver, 10);\n\n\n Runtime.getRuntime().addShutdownHook(\n new Thread(() -> { driver.quit(); driver=null;}));\n }\nRun Code Online (Sandbox Code Playgroud)\n\n和基于测试的课程:
\n\npublic class MyThirdTest extends TestBase {\n\n …Run Code Online (Sandbox Code Playgroud) java selenium automated-tests selenium-webdriver geckodriver
angular ×4
angular9 ×3
.net ×1
angular6 ×1
azure ×1
dart ×1
flutter ×1
geckodriver ×1
java ×1
javascript ×1
localization ×1
ng-bootstrap ×1
nuget ×1
rxjs ×1
selenium ×1
storybook ×1
yeoman ×1