我是一个 angular 5(和 turfjs)菜鸟,试图使用 turfjs()。
我有一个非常简单的 angular 5 项目(用 angular-cli 构建)。
要添加草皮,我跑了:
npm install @turf/along --save
Run Code Online (Sandbox Code Playgroud)
我在我的节点模块目录中看到 @turf/along。我尝试添加到我的 js 文件中:
declare var along: any;
Run Code Online (Sandbox Code Playgroud)
但这没有用。我也尝试添加
"../node_modules/@turf/along/index.js"
Run Code Online (Sandbox Code Playgroud)
到我的 angular-cli.json 文件,但没有运气。
导入此方法以便我可以使用它的正确方法是什么?
当我处于开发模式并且在我的 IDE 中更改代码后(有时)我收到此控制台警告消息:
WARNING in AngularCompilerPlugin:
Forked Type Checker exited unexpectedly.
Falling back to type checking on main thread.
Run Code Online (Sandbox Code Playgroud)
基于 Angular 6 和 Angular-cli 6 的项目。更准确的版本:
"@angular/cli": "6.0.8"
"@angular/*": "6.0.4"
我正在通过 VSCode 终端使用node v8.11.3和运行项目npm v5.6.0
任何help || explanation将不胜感激。
试图运行:
npm install @angular-devkit/build-angular
Run Code Online (Sandbox Code Playgroud)
安装时进入下方
npm 错误!在“...npmjs.org/prelude-ls/”附近解析时意外结束 JSON 输入
请帮忙
不久前,我安装了 Angular Cli 7 并通过以下方式启动了干净的项目
ng new my-app
Run Code Online (Sandbox Code Playgroud)
我为css选择了预编译器SASS,但是当我编辑文件styles.sass然后不起作用时,我的styles.sass看起来像这样
h1 { color: red }
Run Code Online (Sandbox Code Playgroud)
但 ng serve 显示此消息
编译失败。
./src/styles.sass (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??嵌入!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/styles.sass) 模块构建失败(来自 ./node_modules/sass-loader/lib/loader.js ):
h1 { ^ "h1 {": 预期的 "}" 之后的 CSS 无效,在 /Users/a/Documents/angular-projects/my-app/src/styles.sass 中为 "{"(第 1 行,第 5 列)
如何解决?为什么会这样?
我有两个任务,需要相互运行:
ng build <library-name> && ng serve
Run Code Online (Sandbox Code Playgroud)
我想在 上监视文件更改<libary-name>,因此我添加了以下内容:
ng build <library-name> --watch && ng serve
Run Code Online (Sandbox Code Playgroud)
这显然不起作用,因为手表永远不会完成,所以 ng serve 永远不会被调用。
ng build <library-name> --watch & ng serve
Run Code Online (Sandbox Code Playgroud)
这个解决方案也不好,因为 ng serve 在 ng build 完成之前就开始了。
有什么办法可以从第一个 ng 构建中捕获Compilation complete消息,然后让文件观察器运行?有什么办法可以像这样启动观察者:
ng build <library-name> && --watch-the-libary-please & ng serve
Run Code Online (Sandbox Code Playgroud)
?
议程:使用 cli 创建新的 angular 项目
配置: 操作系统:Windows10 64bit npm -v: 6.4.1 node -v: 9.11.1 angular cli: latest
观察到以下命令的行为:
c:\AngularDemo>ng new guessthenumber --inlineTemplate
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE guessthenumber/angular.json (3933 bytes)
CREATE guessthenumber/package.json (1321 bytes)
CREATE guessthenumber/README.md (1031 bytes)
CREATE guessthenumber/tsconfig.json (408 bytes)
CREATE guessthenumber/tslint.json (2837 bytes)
CREATE guessthenumber/.editorconfig (245 bytes)
CREATE guessthenumber/.gitignore (503 bytes)
CREATE guessthenumber/src/favicon.ico (5430 bytes)
CREATE guessthenumber/src/index.html (301 bytes)
CREATE guessthenumber/src/main.ts …Run Code Online (Sandbox Code Playgroud) 是否可以将 Angular 7(使用 CLI 7.x)项目配置为使用默认后缀以外的类名后缀?
更具体地说,对于表示对话框的类,我想Dialog在最后使用,而不是DialogComponent,这会不必要地长。对于代表我想要使用的页面的类Page,而不是PageComponent.
例子:
LoginDialog代替LoginDialogComponentMainPage代替MainPageComponent由于tslintAngular 中预设的规则,简单的重命名是不可能的。
我想使用ng-serve --host 0.0.0.0. 我的项目使用 Angular CLI 1.2。
Angular 无法识别我提供的证书,而是创建了自己的证书。我要使用的证书是.pem文件。
--ssl使用 HTTPS 正确启用该标志。如果我禁用它,它会回到 HTTP,所以这个标志有效。
我在 Docker 容器中工作。我在撰写文件中将证书作为一个卷传递,当我使用docker exec -i <id> bash.
如果我忽略客户端和服务器端的无效证书错误,一切都按预期工作。我试图解决的问题是ng-serve使用我的证书。
这是我所做的:
ng-serve --ssl true --ssl-cert <path-to-cert> --ssl-key <path-to-key> 和变化,例如绝对/相对路径。
在package.json文件中设置上述标志。
设置我的.angular-cli.json默认值:
{
...
"defaults": {
...
"serve": {
"sslKey": "<relative-path>",
"sslCert": "<relative-path>"
},
...
},
...
}
Run Code Online (Sandbox Code Playgroud)我已经尝试过以下答案:
通过 HTTPS 获取 angular-cli 到 ng serve
在 https 2018 上运行 Angular Cli Ng Serve
本文中的步骤也不起作用:https : …
有什么方法可以知道要安装哪个与我的 Angular Core 版本兼容的 Angular CLI 版本?他们是完全独立的吗?
在使用 Core v5.2.8 处理现有的 Angular 应用程序时,我看到他们使用 CLI v6.0.8,所以我想知道我们应该使用哪个版本的 CLI?
Angular CLI 和 Angular Core 之间的兼容性没有任何记录。
我有一个使用 CLI 在 Angular 7 上构建的角度解决方案。该应用程序有 2 个区域。它们没有以任何方式连接,但它们使用相同的代码库。
现在我可以去http://localhost:4200/app1,或http://localhost:4200/app2。但它们运行在同一个实例上。我想修改我的配置,这样我就可以写一些类似的东西
ng build --app=app1
Run Code Online (Sandbox Code Playgroud)
并获得独立的解决方案。有什么建议,我能做什么?
下面是我的 angular.json 文件。如您所见,我已经为开发、登台和生产做好了准备。这意味着此刻,我可以写
ng build --build-optimizer --configuration=staging
Run Code Online (Sandbox Code Playgroud)
并为登台环境构建一个版本。
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"vhTogo": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/vhTogo",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/assets",
"src/manifest.json"
],
"styles": [
"src/styles/styles.scss"
],
"scripts": []
},
"configurations": {
"production": { …Run Code Online (Sandbox Code Playgroud)