我已经阅读了文档,其中说如果我想使用,scss我必须运行以下命令:
ng set defaults.styleExt scss
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做并生成该文件时,我仍然在我的控制台中收到此错误:
ng set defaults.styleExt scss
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
如何更改Angular CLI设置的默认favicon?
我尝试了很多东西,但它总是将Angular徽标显示为favicon,即使我删除了该图标(src文件夹中的favicon.ico).它仍然显示,我不知道从哪里加载.
我已将该图标替换为另一个图标,但仍显示Angular徽标:
<link rel="icon" type="image/x-icon" href="favicon.ico">
Run Code Online (Sandbox Code Playgroud) 我有几个失败的测试只输出[object ErrorEvent] thrown.我在控制台中看不到任何可以帮助我查明违规代码的内容.我需要做些什么来追踪这些?
[编辑]:我正在运行Karma v1.70,Jasmine v2.7.0
使用ng --version我得到:
@ angular/cli:1.0.0
这不是最新版本.
由于我的系统上全局安装了Angular CLI,为了升级它,我尝试了:
npm update angular-cli -g
但它不起作用,因为它保持1.0.0版本.
我想使用带有asp.net核心的angular-cli,我需要知道如何更改dist 文件夹的路径
RE:Angular2 2.0.0,angular-cli v1.0.0-beta.11-webpack.8
如何在构建时告诉angular-cli在"dist"的根目录中包含"src/assets"中的文件?
我们部署到Windows主机,需要包含一个"web.config"文件,告诉IIS将所有内容路由到索引.我们正在做这个预备RC4,但随着所有的更新它落在了裂缝(我不记得我们是如何做到的).
我一直在搜索GitHub repo文档,但没有找到任何关于这个主题的用法.也许我在错误的地方?
在ToC中,有一个项目符号"向构建中添加额外的文件",但似乎该部分不存在.
有没有办法运行ng test单个文件而不是整个测试套件?理想情况下,我想在编辑文件时获得最快的反馈循环,但是karma在每次保存时执行整个套件,这在构建足够大的测试套件时有点慢.
我使用Angular-CLI(beta 20)构建了Angular2项目.
有没有办法只针对一个选定的spec文件运行测试?
我曾经有一个基于Angular2快速启动的项目,我可以手动将规范添加到jasmine文件中.但是我不知道如何在业力测试之外设置它,或者如何使用Angular-CLI构建将业力测试限制为特定文件.
我正在尝试测试angular2双向绑定以进行控制input.这是错误:
Can't bind to 'ngModel' since it isn't a known property of 'input'.
Run Code Online (Sandbox Code Playgroud)
app.component.html
<input id="name" type="text" [(ngModel)]="name" />
<div id="divName">{{name}}</div>
Run Code Online (Sandbox Code Playgroud)
app.component.ts
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
name: string;
}
Run Code Online (Sandbox Code Playgroud)
app.component.spec.ts
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { AppService } from './app.service';
describe('App: Cli', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
providers:[AppService]
});
});
it('divName', async(() => {
let …Run Code Online (Sandbox Code Playgroud) 我们已经完成了一个angular2项目设置和内部创建了一个模块(my-module),并在该模块内部使用以下cmd命令创建了一个组件(my-new-component):
ng new angular2test
cd angular2test
ng g module my-module
ng generate component my-new-component
Run Code Online (Sandbox Code Playgroud)
在创建设置和所有组件之后,我们ng test从angular2test文件夹中的cmd 运行命令.
下面的文件是我的my-new-component.component.ts文件:
import { Component, OnInit } from '@angular/core';
import { Router, Routes, RouterModule } from '@angular/router';
import { DummyService } from '../services/dummy.service';
@Component({
selector: 'app-my-new-component',
templateUrl: './my-new-component.component.html',
styleUrls: ['./my-new-component.component.css']
})
export class MyNewComponentComponent implements OnInit {
constructor(private router : Router, private dummyService:DummyService) { }
ngOnInit() {
}
redirect() : void{
//this.router.navigate(['/my-module/my-new-component-1'])
}
}
Run Code Online (Sandbox Code Playgroud)
下面的文件是我的my-new-component.component.spec.ts文件:
/* tslint:disable:no-unused-variable */
import { …Run Code Online (Sandbox Code Playgroud) unit-testing karma-jasmine angular2-routing angular-cli angular
angular-cli ×10
angular ×9
jasmine ×2
angular6 ×1
css ×1
karma-runner ×1
sass ×1
testing ×1
unit-testing ×1