我正在尝试使用 yaga 组件(npm yaga-module)显示一个简单的传单地图。因此,我使用 angular cli 生成了一个新项目,并按照 npm 页面上的介绍进行操作。最后,我得到了一张破地图。
破损地图的图像。
我已经使用传单库 + JS 甚至在离子框架中使用 yaga 实现了一个工作映射。在这两种情况下,如果我删除了leaflet.css 的链接,我都会得到相同的破损地图。但是我必须在哪里链接 css 文件?如果我在.angular-cli.json 中插入路径,它似乎已成功加载。但随后我的地图完全消失了。
我做错了吗?你可以在下面找到我的代码:
app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { YagaModule } from '@yaga/leaflet-ng2';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
YagaModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
app.component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'app-root', …Run Code Online (Sandbox Code Playgroud) 如何在运行 ng serve (npm start) 的 Angular 4 cli 项目中添加离子 (Sass)?
我按照以下步骤操作:
导入离子库
@import "~ionicons/dist/scss/ionicons";
在 variables.scss 中:
$ionicons-font-path: "~ionicons/dist/fonts";
在控制台中没有给出错误,但字体尚未加载且图标未出现。
使用
<link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
工作正常。
我正在尝试将我的 Angular4 应用程序更新为 Angular5。
我尝试按照官方网站建议的程序进行操作,但现在无法再编译,并且出现此错误:
错误 TS5023:未知的编译器选项“compilerOptions”。
这是组件的版本:
Angular CLI: 1.6.8
Node: 7.4.0
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router
@angular/cli: 1.6.8
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript: 2.7.1
webpack: 3.10.0
Run Code Online (Sandbox Code Playgroud)
{
"compilerOptions": {
"baseUrl": "",
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types" …Run Code Online (Sandbox Code Playgroud) 有没有办法在 Nx 工作空间中运行特定的角度规格测试文件?
最近我将我的 Angular 4 cli 应用程序移到了 Nx 工作空间。以前我使用fdescribe来实现此功能。
所以请建议我是否有任何选项可以在 Nx 工作空间中执行此操作?
我们可以通过这种方式排除 node_modules。
"lint": [
{
"project": "src/main/webapp/app/file.json",
"exclude": "**/node_modules/**"
}
]
Run Code Online (Sandbox Code Playgroud)
但是如何排除一个目录下的所有文件呢?
我试过下面的方法。它不工作
"exclude": [
"**/*whatever.pipe.ts",
"**/*whatever_else.component.ts"
]
Run Code Online (Sandbox Code Playgroud)
所以这是我当前的目录路径 "src/main/assets/js/ngx-typeahead"
我必须从 linting 中排除此目录下的所有文件。
我怎样才能做到这一点?
任何建议,将不胜感激。
在我的 Angular 5 应用程序中,我已经 angular-cli 1.6.8
{
"name": "test",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"karma": "ng test",
"test": "jest",
"test:watch": "jest --watch",
"test:ci": "jest --runInBand",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.7",
"@angular/common": "^5.2.7",
"@angular/compiler": "^5.2.7",
"@angular/core": "^5.2.7",
"@angular/forms": "^5.2.7",
"@angular/http": "^5.2.7",
"@angular/platform-browser": "^5.2.7",
"@angular/platform-browser-dynamic": "^5.2.7",
"@angular/platform-server": "^5.2.7",
"@angular/router": "^5.2.7",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"lodash": "^4.12.0",
"moment": "^2.18.1",
"npm": "^5.2.0",
"proxy-polyfill": …Run Code Online (Sandbox Code Playgroud) 我使用 Angular 6
索引.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>My App</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
<script src="./config.js"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
此外,一个组件的模板包含 img 标签:
<img src="assets/spinner.gif">
Run Code Online (Sandbox Code Playgroud)
如果我使用 base-href/deploy-url 参数构建它,一切正常(base href、所有 css 文件等),除了 config.js 和 assets/spinner.gif 的路径 - angular-cli 保留这些路径而不变化。如何解决这个问题?
附注。我尝试使用"assets/spinner.gif", "/assets/spinner.gif", "./assets/spinner.gif"- 结果相同。
angular.json 的PPS片段:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"project_name": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": …Run Code Online (Sandbox Code Playgroud) 我有一个 Angular 应用程序,现在还需要它的桌面版本。我设法让它在电子中运行应用程序,一切都按预期工作。
但是本地化不起作用。在电子应用程序中,我只看到指向本地化文件中实际翻译的本地化键。
我主要是这样翻译 Angular 中的文本:
{{ "localization-key" | translate }}
Run Code Online (Sandbox Code Playgroud)
并且作为 json 文件的翻译基于assets/i18n/
有人知道如何进行本地化工作吗?
嘿,我用最新的 angular cli 创建了一个新项目。它创建了一个使用 jasmine 作为测试框架的项目。我想用摩卡。
我在项目https://github.com/arranbartish/angular-cli-seed/blob/master/karma.conf.js之后添加了所需的插件
有没有人遇到过错误,或者有没有办法找出是什么导致了这个问题。
mocha.js karma-mocha angular-cli karma-chrome-launcher angular
有时我会在 Chrome 中进行一些 css 草图更新,看看这正是我需要的更新。然后我将它们添加到 css 文件中。在这一步,我必须保存 css 文件。但是保存后我在 Chrome 中丢失了我的草图更新。如果我正确地在 css 文件中进行所有更改就可以了。但如果我打印错误或忘记复制一些 css 样式,我必须检查我做错了什么,因为我无法在 Chrome 中检查草图更新。
ng服务一次时如何防止自动重新加载页面?
html google-chrome command-line-interface angular-cli angular
angular ×10
angular-cli ×10
typescript ×2
css ×1
electron ×1
html ×1
ionicons ×1
javascript ×1
karma-mocha ×1
leaflet ×1
lint ×1
mocha.js ×1
ngrx ×1
node.js ×1
npm ×1
nrwl ×1
sass ×1