我从最近两天开始面临这个问题。我已经将Angular的版本从版本4更新到了版本6,但是之后,我无法创建生产版本。纱线构建,纱线开发等命令运行正常。但是,当我运行yarn build:prod时,出现错误未知选项:-p。我对Angular来说还很陌生,无法弄清楚出了什么问题。因此,任何帮助将不胜感激。
Package.json
{
"name": "nitrogen",
"version": "0.0.1",
"license": "MIT",
"scripts": {
"ng": "ng",
"dev": "node --max_old_space_size=8000 ./node_modules/.bin/ng serve --proxy-config proxy.conf.json",
"serve:prod": "yarn build:prod && hs -p 4200 dist/",
"build": "ng build",
"build:dev": "ng build --statsJson",
"build:prod": "ng build -prod -aot --statsJson -d /admin",
"test": "ng test",
"coverage": "ng test --watch false --cc",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0", …Run Code Online (Sandbox Code Playgroud) 我有一个MVC项目(.net Framework 4.5),一个大型项目,许多视图和控制器,我想更改带有angular 6组件的index.cshtml视图。意味着只有主页将通过使用其他角度进行开发,其他将保持不变,如果可能的话,它会告诉我如何做
我只想将firbase安装为数据库,但不断收到此错误:
ERROR Error: permission_denied at /courses: Client doesn't have permission to access the desired data.
at errorForServerCode (index.cjs.js:647)
at onComplete (index.cjs.js:9114)
at Object.onComplete (index.cjs.js:12681)
at index.cjs.js:11797
at PersistentConnection.push../node_modules/@firebase/database/dist/index.cjs.js.PersistentConnection.onDataMessage_ (index.cjs.js:12052)
at Connection.push../node_modules/@firebase/database/dist/index.cjs.js.Connection.onDataMessage_ (index.cjs.js:11337)
at Connection.push../node_modules/@firebase/database/dist/index.cjs.js.Connection.onPrimaryMessageReceived_ (index.cjs.js:11331)
at WebSocketConnection.onMessage (index.cjs.js:11232)
at WebSocketConnection.push../node_modules/@firebase/database/dist/index.cjs.js.WebSocketConnection.appendFrame_ (index.cjs.js:10837)
at WebSocketConnection.push../node_modules/@firebase/database/dist/index.cjs.js.WebSocketConnection.handleIncomingFrame (index.cjs.js:10887)
Run Code Online (Sandbox Code Playgroud)
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { environment } from '../environments/environment';
imports: [
BrowserModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFireDatabaseModule, …Run Code Online (Sandbox Code Playgroud) javascript firebase firebase-realtime-database angular6 firebase-security-rules
我正在使用Angular进行练习,尝试使用“内置验证器”时遇到问题。我尝试将表单字段的值作为参数传递,但是当我尝试执行此操作时,我只是看到标题为“无法读取未定义的属性'get'的未定义”的错误信息:
this.form = new FormGroup({
'name': new FormControl(this.name, [
Validators.required,
Validators.minLength(4),
forbiddenNameValidator(this.name)
]),
'alterEgo': new FormControl(this.alterEgo),
'power': new FormControl(this.power, Validators.required)
});
Run Code Online (Sandbox Code Playgroud)
...更多代码...
get name(): string { return this.form.get('name').value };
get power(): string { return this.form.get('power').value };
Run Code Online (Sandbox Code Playgroud)
当我尝试将forbiddenNameValidator(this.name)方法作为参数发送时,出现该错误。
<form [formGroup]="form" (ngSubmit)="Ver()">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" name="name" formControlName="name">
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
我有一个显示在表中的用户列表,每个用户都有显示的链接,可以导航到.
<div class="inline-icon-text">
<small class="text-muted d-md-none mr-3">Link</small>
<a [attr.href]="candidate.url" target="_blank" [title]="candidate.url">
<i class="material-icons">open_in_new</i>
</a>
</div>
Run Code Online (Sandbox Code Playgroud)
问题是,当我检查链接元素时,它指向正确的地址,但点击后它会附加到app base url.
<a _ngcontent-c15="" target="_blank" href="www.test.sk" title="www.test.sk">...</a>
Run Code Online (Sandbox Code Playgroud)
点击后,它会在地址为localhost:4200/www.test.sk的新标签页中打开
我错过了什么?
主题:Angular 6,反应形式,下拉菜单,禁用一个选项:禁用所有功能,而不仅仅是一个预期值,即使检查员说disable = false。
人们很乐意为我解决我的问题:“ Angular 6反应形式-选择选项:禁用以前选择的选项 ”,但是当我遇到障碍时它们似乎消失了,因此我提出了新的问题:
为什么禁用所有选项值,而不是仅禁用应该与该语句匹配的选项值? [attr.disabled]="uplink2x === dropdown1Val"(即使我禁用了硬编码,nic0而不是dropdown1Val禁用所有选项)
component.ts:
nicAdapters: any[] = ['nic0','nic1','nic2','nic3','nic4','nic5','nic6','nic7','nic8','nic9','nic10']
this.inputForm = this.fb.group({
upLinks: this.fb.group ({
NumberUplinks: ['2'],
uplinksMgmt: this.fb.group ({
uplink1: ['nic0'],
uplink2: ['nic1'],
uplink3: ['nic3'],
})
})
})
public changedVal(val) {
this.dropdown1Val = val;
}
Run Code Online (Sandbox Code Playgroud)
component.html:
<div class="select" formGroupName="uplinksMgmt">
<select formControlName="uplink1" id="uplink1Id" class="selectBox" (change)="changedVal($event.target.value)">
<option *ngFor="let uplink1x of nicAdapters" [ngValue]="uplink1x">{{uplink1x}}</option>
</select>
</div>
<div class="select" formGroupName="uplinksMgmt">
<select formControlName="uplink2" id="uplink2Id" class="selectBox" (change)="changedVal($event.target.value)">
<option *ngFor="let uplink2x of nicAdapters" [attr.disabled]="uplink2x …Run Code Online (Sandbox Code Playgroud) 我得到了tslint waring select is deprecated: from 6.1.0. Use the pipeable
'select' operator instead.
我的选择器如下所示
private availableStudents$ = this.store.select(getAvailableStudents);
还有我的package.json
"rxjs": "^6.0.0"
"tslint": "~5.9.1"
"typescript": "^2.9.2"
"@angular/cli": "~6.1.2
我有一个结构为{type:“ Buffer”,data:Array(702549)}的File对象类型,我需要在angular 6中做什么才能在浏览器中下载该文件?
我从此函数得到响应:
getMarketingProposalById(id: string): Observable<MarketingProposal> {
return this.httpClient.get<MarketingProposal>(this.apiUrl + id , this.httpOptions).pipe(map(marketingProposal => {
if (marketingProposal.materials[0] && marketingProposal.materials[0].file) {
const blob = new Blob([marketingProposal.materials[0].file.data], { type: 'image/png' });
console.log(blob);
// saveAs(blob, 'hello.png');
}
const marketingProposalObject = this.assignMarketingProposalObject(marketingProposal);
this.mapStringToDate(marketingProposalObject);
return marketingProposalObject;
}));
}
Run Code Online (Sandbox Code Playgroud)
marketingProposal.materials [0] .file的格式为{类型:“缓冲区”,数据:数组(702549)}
我创建了MatTableDataSource实例,然后向其中添加了数据并将其绑定到mat-table。后来我将过滤器应用于此数据源,它在mat-table中显示了已过滤的行。如何在代码中获取这些过滤的行。
如何通过搜索从ng-select字段中删除“清除按钮”?
我在ng-select包中使用angular 6:https : //www.npmjs.com/package/@ng-select/ng-select