小编moh*_*adi的帖子

示意图输入未针对Angular 7上的Schema:{“ name”:“ testng7”}进行验证

我将Angular CLI更新@angular/cli@7.0.2为Mac OS上的最新版本。发出命令时ng new testng7,出现此错误:

Schematic input does not validate against the Schema: {"name":"testng7"}
Errors:
  Data path "" should have required property 'version'.
Run Code Online (Sandbox Code Playgroud)

什么也没有创造。任何线索如何解决?

angular-cli angular angular7

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

在Unicode问题上用正则表达式替换/替换全部

有没有一种方法可以将这种replace方法应用于一般的Unicode文本(这里是阿拉伯语)?在下面的示例中,虽然替换整个单词在英语文本上效果很好,但是它无法检测到,因此替换了阿拉伯单词。我添加了u作为标记以启用unicode解析,但这没有帮助。在下面的阿拉伯语示例中,单词?????? 应该替换,但不能替换???????,但这不会发生。

<!DOCTYPE html>
<html>
<body>
<p>Click to replace...</p>
<button onclick="myFunction()">replace</button>
<p id="demo"></p>
<script>
function myFunction() {
  var str = "????? ?????? ???????? ?? ?????? ???????";
  var rep = '??????';
  var repWith = '?????';

  //var str = "the sun and the stars, then the starsz and the day";
  //var rep = 'stars';
  //var repWith = 'night';

  var result = str.replace(new RegExp("\\b"+rep+"\\b", "ug"), repWith);
  document.getElementById("demo").innerHTML = result;
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

并且,无论您提供什么解决方案,都请使用上面代码中的变量(上面的变量rep),因为要查找的这些替换词是通过函数调用传递的。

更新:要尝试上面的代码,请用上面的代码替换此处 …

javascript regex

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

在Intellij 2016中,服务器和应用程序的消息显示在哪里?

在IntelliJ 15中运行Gradle项目时,我会得到这样的详细输出,给我一个单击以启动我的应用程序的链接,并使用println如下所述的语句查看输出语句. 在此输入图像描述

现在,我刚安装了IntelliJ 2016,这就是Run输出窗口的样子; 就是这样!没有链接,我不能println像以前那样看到我的陈述的输出!只是无用的旋转器计算时间,没有别的.我错过了一扇窗户吗?

在此输入图像描述

console grails intellij-idea gradle

3
推荐指数
1
解决办法
318
查看次数

滚动到 Angular 应用程序中的表格行或列表项

在下面的代码快照中app.component.html,我在第 39 到 58 行的表中显示可单击的行。一旦用户单击一行,我就会在suraTable第 63 到 77 行所示的表中显示其他相关行。即,当用户单击时连续调用函数onSelectAya(aya, suraTable)in 。app.component.ts该函数加载必要的行并显示表格。

我所坚持的是这个。假设suraTable最终有 100 行。当前的行为是当然显示第 1、2、3...行。我需要能够显示第 50 行的表格(aya第 91 行参数中携带的信息)。我如何滚动到该位置?我尝试了scrollTop方式,但是当检查设置之前和之后的值时suraTable.scrollTop,该值始终为0(即0像素)。第 100 行显示,当console.log(suraTable)到达时,浏览器中会生成预期的输出,这意味着我一开始就正确地掌握了该元素。

那么,如何从组件内滚动到表中的特定行或列表中的项目(如果更容易的话,我可以将整个结构转换为列表)app.component.ts?谢谢。

在此输入图像描述

html scroll typescript angular

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

在 Angular 6 中写入文件

我正在尝试在我的 Angular 6 应用程序中实现类似“您是 n 号访客”的功能。我没有使用数据库,所以最好的办法是将数字存储在资产文件夹中的文件中,然后从中读取数字,更新并存储增加的数字。

阅读很容易,如:

this.http.get("/assets/visits").subscribe(vn => {
  this.visitNums = +vn + 1;
});
Run Code Online (Sandbox Code Playgroud)

但我在写入文件时遇到问题。我试过:

fs.writeFile("/assets/visits, 'whatever',
             err => console.log(err));
Run Code Online (Sandbox Code Playgroud)

但即使使用以下命令,我也会收到“找不到 fs 模块”的消息:

import * as fs from "fs";
Run Code Online (Sandbox Code Playgroud)

而且,还做了:

declare const fs: any;
Run Code Online (Sandbox Code Playgroud)

在该行给出“fs 未定义” fs.writeFile

那么,有没有办法从 Angular 6 应用程序中写入文件?

file angular

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