小编afe*_*eef的帖子

储存库不干净。在Angular 8中进行更新之前,请提交或存储任何更改

错误

储存库不干净。请先提交或存储任何更改,然后再进行更新

当我从版本7更新到Angular 8时。

Angular升级指南https://update.angular.io/#7.0:8.0

  D:\app-test> ng update @angular/cli @angular/core
               npm cache verify
Run Code Online (Sandbox Code Playgroud)

储存库不干净。请在更新之前提交或存储任何更改。

更新版本

    PS D:\app-test> ng update
                Using package manager: 'npm'
                Collecting installed dependencies...
                Found 58 dependencies.
                    We analyzed your package.json, there are some packages to update:

                      Name                               Version                  Command to update
                     --------------------------------------------------------------------------------
                      @angular/cdk                       7.2.2 -> 8.0.1           ng update @angular/cdk
                      @angular/core                      7.2.15 -> 8.0.1          ng update @angular/core
                      @angular/core                      7.2.2 -> 7.2.15          ng update @angular/core
                      @angular/material                  7.3.7 -> 8.0.1           ng update @angular/material
                      rxjs                               6.3.3 -> 6.5.2           ng update …
Run Code Online (Sandbox Code Playgroud)

git typescript angular angular8

20
推荐指数
6
解决办法
1万
查看次数

Angular 8更新后ng服务无法正常工作

错误

找不到构建器@ angular-devkit / build-angular:dev-server的实现

         ng serve
        Could not find the implementation for builder @angular-devkit/build-angular:dev-server
        Error: Could not find the implementation for builder @angular-devkit/build-angular:dev-server
            at WorkspaceNodeModulesArchitectHost.resolveBuilder (D:\angular-tour-of-heroes\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:49:19)
            at ServeCommand.initialize (D:\angular-tour-of-heroes\node_modules\@angular\cli\models\architect-command.js:135:55)
            at async ServeCommand.validateAndRun (D:\angular-tour-of-heroes\node_modules\@angular\cli\models\command.js:127:9)
            at async Object.runCommand (D:\angular-tour-of-heroes\node_modules\@angular\cli\models\command-runner.js:178:24)
            at async default_1 (D:\angular-tour-of-heroes\node_modules\@angular\cli\lib\cli\index.js:32:31)
Run Code Online (Sandbox Code Playgroud)

ng版本

              Angular CLI: 8.0.3
                Node: 12.4.0
                OS: win32 x64
                Angular: 7.2.2
                ... animations, cdk, common, compiler, core, forms, http
                ... platform-browser, platform-browser-dynamic, router
                ... service-worker

                Package                           Version
                -----------------------------------------------------------
                @angular-devkit/architect         0.13.9
                @angular-devkit/build-angular     0.13.9
                @angular-devkit/build-optimizer   0.13.9
                @angular-devkit/build-webpack     0.13.9
                @angular-devkit/core              8.0.3 …
Run Code Online (Sandbox Code Playgroud)

npm angular-cli angular8

17
推荐指数
1
解决办法
6324
查看次数

没有将 exportAs 设置为 matAutocomplete 的指令

错误

没有将“exportAs”设置为“matAutocomplete”的指令(“-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto">

我使用了https://material.angular.io/components/autocomplete/overview 中的代码

我还包括在 angular 中的导入app.module.ts

import { 
         MdAutocompleteModule,

  } from '@angular/material';
Run Code Online (Sandbox Code Playgroud)

html组件

<form class="example-form">
    <mat-form-field class="example-full-width">
        <input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto">
        <mat-autocomplete #auto="matAutocomplete">
            <mat-option *ngFor="let option of options" [value]="option">
                {{ option }}
            </mat-option>
        </mat-autocomplete>
     </mat-form-field>
</form>
Run Code Online (Sandbox Code Playgroud)

ng--版本

@angular/cli: 1.2.1
node: 8.3.0
os: win32 x64
@angular/animation: 4.0.0-beta.8
@angular/animations: 4.3.3
@angular/cdk: 2.0.0-beta.8
@angular/common: 4.3.2
@angular/compiler: 4.3.2
@angular/core: 4.3.6
@angular/forms: 4.3.2
@angular/http: 4.3.2
@angular/material: 2.0.0-beta.8
@angular/platform-browser: 4.3.2
@angular/platform-browser-dynamic: 4.3.2
@angular/router: 4.3.2 …
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular-material2 angular

11
推荐指数
1
解决办法
9956
查看次数

错误:检测到AotPlugin但它是错误类的实例

问题

服务

模块构建失败:错误:检测到AotPlugin但它是错误类的实例.

完整错误报告日志

  ERROR in ./src/main.ts
  Module build failed: Error: AotPlugin was detected but it was an instance of the wrong class.
  This likely means you have several @ngtools/webpack packages installed. You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies.
  at Object.ngcLoader 
 (D:\testingapp\node_modules\@ngtools\webpack\src\loader.js:358:19)
  @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
Run Code Online (Sandbox Code Playgroud)

npm ls @ ngtools/webpack

testingapp@0.0.0 D:\testingapp
 +-- @angular/cli@1.2.6
 | `-- @ngtools/webpack@1.5.5
`-- angular-cli@1.0.0-beta.28.3
 `-- @ngtools/webpack@1.5.1
Run Code Online (Sandbox Code Playgroud)

npm缓存验证

仍然存在问题.

  • 任何建议都是最受欢迎的.

node.js angularjs

7
推荐指数
1
解决办法
5056
查看次数

如何使用Postman在Elastic Search中插入文档

我需要的

我在这里尝试

   PUT /customer/_doc/1?pretty
  {
   "name": "John Doe"
  }
Run Code Online (Sandbox Code Playgroud)

错误请求正文是必需的

当我尝试运行 url 时的快照

1. http://localhost:9200/customer?pretty

在此输入图像描述 2. http://localhost:9200/customer/_doc/1?pretty&pretty 在此输入图像描述

3. http://localhost:9200/customer/_doc/1?pretty&pretty&name=test 在此输入图像描述

任何人都可以建议如何在弹性搜索中插入文档。

  • 任何建议都是非常受欢迎的。

elasticsearch

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

错误找不到模块'@angular/material

错误

找不到模块'@angular/material

app.module.ts

import { MaterialModule } from '@angular/material';
Run Code Online (Sandbox Code Playgroud)

链接:https : //material.angular.io/guide/getting-started

 npm install --save @angular/material @angular/cdk
Run Code Online (Sandbox Code Playgroud)

我尝试过的解决方案

更新

它不起作用。

ng --version

@angular/cli: 1.2.1
node: 8.3.0
os: win32 x64
@angular/animation: 4.0.0-beta.8
@angular/animations: error
@angular/cdk: error
@angular/common: 4.3.2
@angular/compiler: 4.3.2
@angular/core: 4.3.2
@angular/forms: 4.3.2
@angular/http: 4.3.2
@angular/material: error
@angular/platform-browser: 4.3.2
@angular/platform-browser-dynamic: 4.3.2
@angular/router: 4.3.2
@angular/cli: 1.2.1
@angular/compiler-cli: 4.4.3
@angular/language-service: 4.3.2
Run Code Online (Sandbox Code Playgroud)
  • 任何人都可以在运行 npm 命令材料模块停止工作后建议我。

我已经做了工作演示https://github.com/afeef1915/Angular2-Symfony3-Demo

所有代码都运行良好。

  • 任何建议都是最受欢迎的。

安装材料时出错

    D:\Angular2-Symfony3-Demo-master>npm install --save @angular/material @angular/cdk
    npm WARN @angular/animation@4.0.0-beta.8 requires a peer of …
Run Code Online (Sandbox Code Playgroud)

npm node-modules angular

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

角度 - mat-slide-toggle 不可见

问题

mat-slide-toggle 不可见。

我正在尝试从下面的 url https://material.angular.io/components/autocomplete/examples实现这个例子。

测试组件.html

<mat-slide-toggle
[checked]="stateCtrl.disabled"
(change)="stateCtrl.disabled ? stateCtrl.enable() : stateCtrl.disable()">
Disable Input?
Run Code Online (Sandbox Code Playgroud)

app.module.ts

                        import { BrowserModule } from '@angular/platform-browser';
                        import { NgModule,Component, ElementRef, ViewChild,Pipe,PipeTransform,CUSTOM_ELEMENTS_SCHEMA  } from '@angular/core';
                        import { FormsModule,ReactiveFormsModule } from '@angular/forms';
                        import { HttpModule } from '@angular/http';


                        import { AppComponent } from './app.component';

                        //import service libraries declare all services used in project here//
                        import { HeroService } from './hero.service';
                        import { UserService } from './user.service';
                        import { AlertService } from  './alert.service';
                        import {AuthenticationService …
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular

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

Angular 7中的$是什么意思

我对变量声明有些困惑.

什么意味着英雄$

Angular 4

export class HeroSearchComponent implements OnInit {
heroes: Observable<Hero[]>;
private searchTerms = new Subject<string>();

constructor(
 private heroSearchService: HeroSearchService,
 private router: Router) {}
Run Code Online (Sandbox Code Playgroud)

Angular 7+

 export class HeroSearchComponent implements OnInit {
 heroes$: Observable<Hero[]>;
 private searchTerms = new Subject<string>();
 constructor(private heroService: HeroService) {}

     // Push a search term into the observable stream.
          search(term: string): void {
          console.log(term);
            this.searchTerms.next(term);
        }
Run Code Online (Sandbox Code Playgroud)
  • 我在角度7 ver中有混淆,其中英雄被赋予$ variable.

  • 我试图从var中删除$符号然后代码不起作用.

  • 任何建议都是最受欢迎的

angular angular7

5
推荐指数
1
解决办法
834
查看次数

如何在 Angular 9 中从子组件访问父组件

问题

  • 无法使用 viewContainerRef 进行父子通信。

代码在 Angular 8.2 中运行

 this.viewContainerRef[ '_data' ].componentView.component.viewContainerRef[ '_view' ].component;
Run Code Online (Sandbox Code Playgroud)

错误

错误类型错误:无法读取未定义的属性“componentView”

公共 API https://angular.io/api/core/ViewContainerRef

    this.viewContainerRef.get(0) still i got null
Run Code Online (Sandbox Code Playgroud)

我需要从子组件访问父组件。

吴版

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.900.7
@angular-devkit/core         9.0.7
@angular-devkit/schematics   9.0.7
@schematics/angular          9.0.7
@schematics/update           0.900.7
rxjs                         6.5.3
Run Code Online (Sandbox Code Playgroud)

无法在 stackblitz 中复制该问题

https://stackblitz.com/edit/angular-testangular9-communicating-x

问题

ViewContainerRef 在 Angular 9 中不起作用

工作视图ContainerRef

在此输入图像描述

ViewConatinerRef 在 Angular 9 中不起作用 在此输入图像描述

任何建议都是非常受欢迎的。

javascript angular

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

cURL 错误 60 - SSL 证书问题 - 无法获取本地颁发者

PHP版本:5.6

问题:我收到错误:

    cURL error 60: SSL certificate problem: unable to get local issuer certificate.
Run Code Online (Sandbox Code Playgroud)

我尝试解决此问题的步骤:

  • php -r "readfile('https://symfony.com/installer');" > symfony

    1. 从https://curl.haxx.se/ca/cacert.pem下载包含更新的证书列表的文件。

    2. 设置路径在php.ini curl.cainfo =D:\xampp_tomact\php\extras\ssl\cacert.pem openssl.cafile=D:\xampp_tomact\php\extras\ssl\cacert.pem

    3. 阿帕奇重启

    4. 然后我尝试用

      php symfony new my_project_name
      
      Run Code Online (Sandbox Code Playgroud)

我从链接中获得了帮助

http://symfony.com/doc/current/setup.html

cURL 错误 60:SSL 证书:无法获取本地颁发者证书

但没有一个解决方案在 xampp windows 中有效。
请建议

我再次尝试的步骤

  1. d:\xampp\htdocs> php -r "readfile('http://symfony.com/installer');" > symfony
  2. d:\xampp\htdocs\projects> php symfony
  3. symfony new my_project_name

执行上面第三条命令后出错:

    cURL error 60: SSL certificate problem: unable to get local issuer 
Run Code Online (Sandbox Code Playgroud)

安装 symfony 时仍然没有解决此错误。

我还关注了 symfony 文档

Symfony 文档图片

CMD命令图片

我也尝试过最后的解决方案:

PHP - SSL …

php ssl curl symfony

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

如何在 Angular 8 中实现嵌套 NG If else 条件

我需要的

        if(field.ajax && field.ajax='Y' && field.multiple&& field.multiple=='Y')
        {

        }
        else if (field.ajax && field.ajax='Y' && field.multiple&& field.multiple=='N'))
        {
        }
        else
        {
        }
Run Code Online (Sandbox Code Playgroud)

2 条件作品

    if(cond)
        {
        code
        }else
        {
        code
        }
Run Code Online (Sandbox Code Playgroud)

这个案例代码有效

   <ng-container *ngIf="field.ajax && field.ajax === 'Y'; else select2ElseBlock">
              <ng-select
              [items]="data"
              multiple="true"
              bindLabel="name"
              [closeOnSelect]="true"
              [loading]="loading"

              [searchable]="true"
              [clearable]="true" 
              (click)="clearModel()"
              (keyup)="changed($event.target.value)">
              </ng-select>
        </ng-container>
       <ng-template #select2ElseBlock>
              <ng-select
              [items]="field.choices.choice"
              multiple="true"
              bindLabel="name"
              [loading]="loading"
              >
              </ng-select>
        </ng-template>
Run Code Online (Sandbox Code Playgroud)

我尝试过多个案例

但这种情况会产生问题

 <ng-container *ngIf="field.ajax && field.ajax === 'Y'  then  select2thenBlock else select2ElseBlock">
          <ng-select
          [items]="data"
          multiple="true"
          bindLabel="name"
          [closeOnSelect]="true"
          [loading]="loading" …
Run Code Online (Sandbox Code Playgroud)

if-statement angular angular8

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