小编Bil*_*l P的帖子

Angular 9 引入了需要加载的全局“$localize()”函数

我在新的 angular 项目设置中遇到以下错误。

已安装的软件包及其版本

错误 错误:未捕获(承诺):错误:您的应用程序或其依赖项之一似乎正在使用 i18n。Angular 9 引入了一个$localize()需要加载的全局函数。请添加import '@angular/localize';到您的 polyfills.ts 文件中。错误:您的应用程序或其依赖项之一似乎正在使用 i18n。Angular 9 引入了一个$localize()需要加载的全局函数。

注意:我来自以下。它建议回退到旧版本。 https://github.com/angular/angular/issues/32508

localization angular angular9

68
推荐指数
9
解决办法
4万
查看次数

升级到 Angular 9 后,在typings 文件中找不到变量

我有一个对外部日志组件的引用(在 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)

angular angular9

12
推荐指数
2
解决办法
4396
查看次数

无法在 Angular 9 中使用 Ng-bootstrap

我使用 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”

我应该安装什么?本地化库的名称是什么?

ng-bootstrap angular angular9

9
推荐指数
2
解决办法
5461
查看次数

Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH. Could you tell me what the problem is?

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)

yeoman yeoman-generator

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

(角度6)路线转换动画不适用于子路线

我必须在路由器插座上设置路由器动画。实际上,我要动画的只是一个路由。这是我的路由模块:

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)

angular2-routing angular-animations angular6

7
推荐指数
0
解决办法
400
查看次数

Azure函数中的程序集绑定重定向

我创建了一个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 / 但是,这也无济于事.

对于这种情况,是否有一个我缺少的步骤或任何其他解决方法?感谢帮助.

.net azure nuget assembly-binding-redirect azure-functions

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

如何在for循环中打印整个列表?

我只是想练习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)

javascript

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

使用旋钮更改 observable 的值

我目前正在使用 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)

我希望故事书向我展示实际的组件,并且我可以在旋钮内切换它,但什么也没有。

rxjs angular storybook

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

在 Flutter 中获取没有构建上下文的类中的屏幕大小

我试图在没有构建方法的自定义类中获取颤动的屏幕大小。如何在不使用 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':不是真的。

dart flutter

6
推荐指数
3
解决办法
2945
查看次数

Selenium 在 Firefox 浏览器窗口中运行一些测试时出现“找不到配置文件目录”错误

请建议我。我正在学习 Selenium WebDriver 工具并尝试在 Firefox 窗口中运行一些测试,但第二次测试总是失败。我怎样才能避免这种情况?

\n\n

Gecko 驱动程序:v0.25.0-win32;

\n\n

硒:3.141.59;

\n\n

框架:JUnit;

\n\n

火狐:69.0

\n\n

我尝试了隐式等待和显式等待,但没有帮助。

\n\n

我的通用 TestBase java 类:

\n\n
public 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  }\n
Run Code Online (Sandbox Code Playgroud)\n\n

和基于测试的课程:

\n\n
public class MyThirdTest extends TestBase {\n\n …
Run Code Online (Sandbox Code Playgroud)

java selenium automated-tests selenium-webdriver geckodriver

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