标签: angular6

“HttpIntercept”类型中的属性“intercept”不可分配给基类型“HttpInterceptor”中的同一属性

我正在尝试运行角度应用程序。使用 ng 服务,但出现错误,如下所示:

node_modules/angular-authentication-service/dist/app/classes/http.intercept.d.ts(5,5) 中的错误:错误 TS2416:“HttpIntercept”类型中的属性“intercept”无法分配给基中的同一属性输入“HttpInterceptor”。

Package.json 文件

"dependencies": {
    "@angular/animations": "^7.2.10",
    "@angular/cdk": "^7.3.5",
    "@angular/common": "7.0.1",
    "@angular/compiler": "7.0.1",
    "@angular/core": "7.0.1",
    "@angular/flex-layout": "^7.0.0-beta.24",
    "@angular/forms": "^6.1.10",
    "@angular/http": "^6.1.10",
    "@angular/material": "^6.4.7",
    "@angular/platform-browser": "7.0.1",
    "@angular/platform-browser-dynamic": "^7.2.10",
    "@angular/router": "7.0.1",
    "@firebase/app-types": "^0.3.7",
    "@firebase/auth-types": "^0.3.4",
    "@firebase/database-types": "^0.3.8",
    "@firebase/firestore-types": "^0.7.0",
    "@firebase/messaging-types": "^0.2.8",
    "@firebase/storage-types": "^0.2.8",
    "@ngrx/store": "^5.2.0",
    "angular-alert-module": "^2.0.3",
    "angular-authentication-service": "^1.1.8",
    "angular2-moment": "^1.9.0",
    "angularfire2": "^5.1.2",
    "bootstrap": "^4.3.1",
    "core-js": "^2.6.5",
    "firebase": "^5.9.1",
    "hammerjs": "^2.0.8",
    "jquery": "^3.3.1",
    "moment": "^2.24.0",
    "ng2-toasty": "^4.0.3",
    "ngx-alerts": "^3.4.1",
    "ngx-embed-video": "^0.3.0",
    "pusher-angular": "^1.0.0",
    "pusher-js": "^4.4.0",
    "rxjs": "^6.4.0", …
Run Code Online (Sandbox Code Playgroud)

node-modules angular angular6

3
推荐指数
2
解决办法
5562
查看次数

无法为 ngx 智能模式设置自定义宽度

我正在尝试在 ngx-smart-modal 中设置自定义宽度。

我已经尝试了(如何将独特的自定义 CSS 添加到 ngx-smart-modals)上给出的步骤,并且还尝试了在 github 上为此项目创建的问题的解决方案,但没有运气:(。

版本“ngx-smart-modal”:“^7.1.1”,

在我导入的全局 styles.scss 中

@import '~ngx-lightbox/lightbox.css';

@import "~ngx-smart-modal/ngx-smart-modal";

在组件 .html 中

<ngx-smart-modal [customClass]="'pack-modal-custom'" #packModal identifier="packModal" class="pack-modal">
  <p>
     love this game
  </p>
</ngx-smart-modal>
Run Code Online (Sandbox Code Playgroud)

在组件 .scss 中

.pack-modal-custom{
  min-width: 800px !important;
  max-width: none !important;
  background-color: black !important;
 }
Run Code Online (Sandbox Code Playgroud)

但这个模态的宽度仍然是 520px,这是在 .nsm-dialog 中设置的。我做错了什么吗?

modal-dialog angular angular6

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

禁用 Angular Material 日期选择器中的特定日期

我正在尝试为我的一个项目使用 Angular 6 Material 日期选择器。我需要禁用特定日期或为用户提供选择特定日期的选项(可以是一些随机日期)。

<mat-card>
    <input matInput [matDatepicker]="picker" placeholder="Choose a date">
    <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
    <mat-datepicker #pickers></mat-datepicker>
    <app-date-picker></app-date-picker>
  </mat-card>
``
Run Code Online (Sandbox Code Playgroud)

angular-material angular angular6 angular-material-datetimepicker

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

为什么我收到这些错误“没有带有路径的表单控件的值访问器:'rowDetails -&gt; 0 -&gt; no'”

当我们尝试使用 formGroup 时,我们会遇到一些错误。我需要一些关于表单组的解释。我想创建一个包含数据的表单组。数据需要逐行显示。 当我运行它时,我们使用 Angular 8 ,我收到此错误:

路径没有表单控件的值访问器:'rowDetails -> 0 -> no'

我有这个组件的构造函数:

 constructor(
    public fb: FormBuilder
    ) { 
      this.summaryForm = this.fb.group({
        rowDetails: this.fb.array([])
      })
    }
Run Code Online (Sandbox Code Playgroud)

我有这个组件控制器:

ngOnInit() {
    this.productList = (this.selectedReceiptBatch.incomeSummary as SaleSummary).sales;
    this.summaryForm = this.fb.group({
      rowDetails: this.fb.array(
        this.productList.map(x=> this.fb.group({
              'no': x.product.code,
              'desc': x.product.productClass,
              'numberx': [x.number.x],
              'numbery': x.number.y,
              'amountz': x.number.z,
              'reference': [x.reference]
        })
      )) 
    });
    console.log(this.summaryForm);
    this.formControlAvailable = true;
  }
Run Code Online (Sandbox Code Playgroud)

HTML:


<div *ngIf="formControlAvailable">

  <div>

    <div [formGroup]="summaryForm">
      <div formArrayName="rowDetails">
        <div *ngFor="let row of summaryForm.controls.rowDetails.controls; let index = index">
          <div [formGroupName]="index"> …
Run Code Online (Sandbox Code Playgroud)

forms angular formarray formgroups angular6

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

如何在 Angular 中安装 Quill.js

抱歉,我对包装工作原理的理解Angular很糟糕!我想WYSIWYG在我的Angular6应用程序中使用编辑器。我已经归零到了quill.js。https://quilljs.com/docs/quickstart/

但我很困惑如何将它包含在我的项目中。我已将其添加为我的package.json.

  "dependencies": {
...
    "quill": "1.3.6"
  }
Run Code Online (Sandbox Code Playgroud)

然后我尝试用于以下用途textarea

<textarea id="question-description" type="text" class="form-control" formControlName="questionDescription" [ngClass]="validateField('questionDescription')"  rows="4"></textarea>
Run Code Online (Sandbox Code Playgroud)

Quill并像下面一样初始化ngAfterViewInit

var quill = new Quill('#question-description', {
  theme: 'snow'
});
Run Code Online (Sandbox Code Playgroud)

但我收到错误

ReferenceError: Quill is not defined
    at NewPracticeQuestionComponent.push../s
Run Code Online (Sandbox Code Playgroud)

我还在组件文件declare var Quill:any;的顶部添加了.ts

我可以看到node_modules有一个quill文件夹,其中有dist/quill.js我认为Quill必须定义和导出对象的位置(但尚未检查)。

我究竟做错了什么?

quill angular angular6

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

将Angular 5更新为Angular 6错误

我刚从角度5更新到角度6,我面临角度动画的问题.

我做了标准升级

npm install -g @angular/cli
npm install @angular/cli
ng update @angular/cli --migrate-only --from=1.7.4
ng update @angular/core
npm install rxjs-compat (most project probably need this)
ng serve
Run Code Online (Sandbox Code Playgroud)

我还根据官方升级指南(https://update.angular.io/)从5.2到6 更新了我的代码库,但是有一个错误,我无法弄清楚.

ERROR in src/app/dispute-center/shared/services/dispute-store-service.ts(1,22): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'transition'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,28): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'trigger'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,37): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'state'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,44): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no exported member 'style'.

src/app/profile/profile-payments-and-billing/profile-payments-and-billing.component.ts(1,51): error TS2305: Module '"/var/www/html/xxx-angular/node_modules/@angular/core/core"' has no …
Run Code Online (Sandbox Code Playgroud)

angular2-template angular2-routing angular angular5 angular6

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

Angular 6,Firebase 3.9.0-在node_modules / firebase / auth.js中未定义全局

因此,我正在使用Angular 6使用AngularFire2构建Web应用程序,并且在加载应用程序时出现以下错误:

auth.js:255 Uncaught ReferenceError: global is not defined
    at Object../node_modules/firebase/auth.js (auth.js:255)
    at __webpack_require__ (bootstrap:81)
    at Object../node_modules/firebase/firebase-browser.js (firebase-browser.js:11)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/core/auth.service.ts (auth.guard.ts:18)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/app.component.ts (main.js:156)
    at __webpack_require__ (bootstrap:81)
    at Object../src/app/app.module.ts (app.component.ts:9)
    at __webpack_require__ (bootstrap:81)
./node_modules/firebase/auth.js @ auth.js:255
__webpack_require__ @ bootstrap:81
./node_modules/firebase/firebase-browser.js @ firebase-browser.js:11
__webpack_require__ @ bootstrap:81
./src/app/core/auth.service.ts @ auth.guard.ts:18
__webpack_require__ @ bootstrap:81
./src/app/app.component.ts @ main.js:156
__webpack_require__ @ bootstrap:81
./src/app/app.module.ts @ app.component.ts:9
__webpack_require__ @ bootstrap:81
./src/main.ts @ environment.ts:15
__webpack_require__ @ bootstrap:81
0 @ main.ts:14
__webpack_require__ @ …
Run Code Online (Sandbox Code Playgroud)

firebase angularfire2 angular angular6

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

Angular 6中的Observable <string>类型中不存在属性'publish'

我正在写我的第一个Angular申请表Angular 6.

我正在实现错误处理来处理单个地方的所有错误,为此,我正在遵循此媒体指南

根据stackblitz上的指南代码示例,我的NotificationService就像

import {Injectable} from '@angular/core';
import {BehaviorSubject, Observable} from 'rxjs';

import {publish} from 'rxjs/operators';

@Injectable()
export class NotificationService {
  private _notification: BehaviorSubject<string> = new BehaviorSubject(null);
  readonly notification$: Observable<string> = this._notification.asObservable().publish().refCount();

  constructor() {}

  notify(message) {
    this._notification.next(message);
    setTimeout(() => this._notification.next(null), 5000);
  }
}
Run Code Online (Sandbox Code Playgroud)

IDE正在给出错误 publish()

在此输入图像描述

我甚publish至从rxjs/operators导入但导入显示未使用.我也尝试了导入示例中的导入,但仍然得到相同的错误.

rxjs angular angular6

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

防止删除package.json的脚本部分(库角度)

我制作了一个带角度6的库。构建库时,的脚本部分package.json将被删除。我该如何防止呢?(库建立后我需要脚本部分)

如何建造: ng build --prod MyLibraryName

angular6

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

Angular 2-ngIf Alternative,它不会每次ngIf值更改时都初始化组件

我有一个自定义的标签实现,在其中我用一些ngIf指令显示标签内容,如下所示:

<tab1 *ngIf="condition === 1"></tab1>
<tab2 *ngIf="condition === 2"></tab2>
Run Code Online (Sandbox Code Playgroud)

制表符具有自己的形式,某些内容仅应初始化一次,不再需要初始化。在我当前的实现中,每次我更改条件然后更改选项卡时,都会再次初始化组件tab1和tab2。

我们是否还有其他ngIf替代项(例如可能是旧的ng-show),它不会再次初始化组件,而只是淡出UI上的新内容。否则,我必须使用CSS(不显示任何内容)来做。

angular angular6

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