小编mru*_*ova的帖子

如何使用Angular Reactive表单在父组件中添加子组件?

我正在向父组件表单添加子组件.

Pessoa.html

<form [formGroup]="usuarioForm" novalidate>
                <div class="col-md-4">
                    <div class="form-group">
                        <label for="exampleInputNome">Nome</label>
                        <input type="text"
                               formControlName="nome"
                               class="form-control "
                               placeholder="Nome" />
                    </div>
                </div>

            <endereco [enderecoGroup]=usuarioForm></endereco>

            <button type="submit"
                    class="btn btn-default"
                    (click)="InsereUsuario(usuarioForm.value)">
                Enviar
            </button>
</form>
Run Code Online (Sandbox Code Playgroud)

Endereco.html

            <h4>Endereço</h4>
            <div class="col-md-2">
                <div class="form-group" [formGroup]="enderecoGroup">
                    <label for="exampleInputCep">Cep</label>
                    <input type="text"
                           class="form-control"
                           placeholder="Cep"
                           (blur)="GetAdress($event.target.value)">
                </div>
            </div>
            <div class="col-md-4">
                <div class="form-group" [formGroup]="enderecoGroup">
                    <label for="exampleInputComplemento">Complemento</label>
                    <input type="text"
                           class="form-control"
                           placeholder="Complemento"
                           [value]=endereco?.complemento>
                </div>
            </div>
Run Code Online (Sandbox Code Playgroud)

Endereco.ts

@Input() enderecoGroup: FormGroup;

endereco: Endereco

GetEndereco(Cep: string) {
    this.servico.GetEndereco(Cep)
        .subscribe(resposta => this.endereco = resposta);
}
Run Code Online (Sandbox Code Playgroud)

提交表单时,Adress.html条目为空白,我该怎么办?

我正在使用React表单

Stackblitz

在此输入图像描述

angular angular4-forms angular-forms

10
推荐指数
1
解决办法
262
查看次数

如何让我的Angular5 spyOn按预期工作?

我的测试没有检测到变化.这是我的组件:

  toggleUploadModal() {
    const modalRef = this.ngbModal.open(UploadFilesComponent, { size: 'lg', backdrop: 'static' });
    modalRef.componentInstance.DeliverableTransaction = this.transactionDetails;
    modalRef.result.then((res) => {
      if (res.status === 'success') {
        this.deliverableTransactionService.updateDeliverableTransaction(this.route.snapshot.params.id, {
          submissionStatus: 'In Process'
        })
      }
      setTimeout(() => {
        this.uploadStatus = {};
      }, 5000);
    })
  }
Run Code Online (Sandbox Code Playgroud)

我的测试有:

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [TransactionFileViewer, NgxPermissionsAllowStubDirective],
      providers: [...],
      imports: [...],
      schemas: [
        NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA
      ],
    })
      .compileComponents();
    fixture = TestBed.createComponent(TransactionFileViewer);
    downloadService = TestBed.get(DownloadService);
    component = fixture.componentInstance;
    fixture.detectChanges();
    submissionFileService = TestBed.get(SubmissionFileService);
    deliverableDefinitionService = TestBed.get(DeliverableDefinitionService);
    service = TestBed.get(DeliverableDefinitionDetailViewService);
    deliverableTransactionService …
Run Code Online (Sandbox Code Playgroud)

stub spy bluebird angular angular5

10
推荐指数
1
解决办法
198
查看次数

角材料步进器更改图标颜色

我正在使用角 6 和角材料。我正在使用角材料的垫子步进器。想要更改默认、活动和访问步骤的垫子图标颜色。任何人都可以帮忙吗?

:host /deep/ mat-horizontal-stepper .mat-horizontal-stepper-header-container .mat-step-icon {
    background-color: "red" !important;
    color: #fff !important;
}

.mat-step-icon-selected,
.mat-step-icon-state-done,
.mat-step-icon-state-edit {
  background-color: "blue";
  color:#fff;
}  
Run Code Online (Sandbox Code Playgroud)

也试过这个:

/deep/ mat-step-header.mat-horizontal-stepper-header > div.mat-step-icon-selected {
    background-color:'red';
}
Run Code Online (Sandbox Code Playgroud)

但不工作

谢谢

angular-material angular

9
推荐指数
1
解决办法
9031
查看次数

如何在Nativescript应用程序中创建angular 2组件?

我正在使用带有角度2的nativescript。

我想知道如何在Nativescript项目中快速创建ng组件。例如,在Angular 2中创建我们正在使用的组件ng generate component hello

是否有针对此的nativescript CLI解决方案?

nativescript angular2-nativescript angular

8
推荐指数
3
解决办法
6826
查看次数

角度:不建议创建:改用new Observable()

我最近在使用ng update 和运行时更新了我的angular版本ng lint

我收到错误 create is deprecated: use new Observable() instead

this.data$ = Observable.create(t => {
    t.next(this.model);
    t.complete();
});
Run Code Online (Sandbox Code Playgroud)

new observable的语法是什么?

angular-material angular angular7

8
推荐指数
4
解决办法
3023
查看次数

无法从 AWS S3 访问被拒绝错误下载文件

当我尝试通过控制台从 AWS S3 下载一个文件时,出现以下错误:

此 XML 文件似乎没有任何与之关联的样式信息。

文档树如下所示。

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>DF19E559FDBA71C2</RequestId>
<HostId>f5cIaO8eh2yTmC+rtVIVg54xY4EXAjG6lsxzjbBjzMRwDWaMFaggAU3Wyoipy2ZuDHQLhz402DE=</HostId>
</Error>
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙解决这个问题。

提前致谢

amazon-s3 amazon-web-services

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

Primeng 使用样式时找不到不同的支持对象“宽度:100%”

当我尝试将样式与 p-menu 或 p-dropdown 一起使用时,出现错误“找不到不同的支持对象 'width: 100%'”。

primeng angular angular5

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

ng更新与npm更新之间的区别是什么?

有人请向我解释一下 Angular 6中的ng updatenpm update之间的区别吗?

npm-update angular angular-cli-v6

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

为什么我得到 AttributeError: module 'tensorflow' has no attribute 'placeholder'?

三周前我能够运行我的 python 程序,但现在每次我尝试运行它时,我都会收到以下错误:

AttributeError: module 'tensorflow' has no attribute 'placeholder'
Run Code Online (Sandbox Code Playgroud)

我安装了 tensorflow(版本“2.0.0-alpha0”)。我已经阅读了几篇与此问题相关的帖子。他们说我应该卸载 TensorFlow 并重新安装它。问题是我在集群计算机上运行它并且我没有sudo权限。

任何的想法?

tensorflow

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

在浏览器中打开对象 URL 时 AWS S3 访问被拒绝

我是 aws 的新手。我在存储桶中上传了一张图片

如果我尝试在浏览器中打开对象 url,则会出现以下错误。

在此处输入图片说明

下面是我配置我的存储桶的存储桶策略

{
    "Version": "2012-10-17",
    "Id": "Policy1566555268319",
    "Statement": [
        {
            "Sid": "Stmt1566555264845",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::497899159094:user/DevUser"
            },
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": "arn:aws:s3:::akirainfocombucket/*",
            "Condition": {
                "StringEquals": {
                    "s3:x-amz-acl": "public-read"
                }
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

以下是 CORS 配置

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <AllowedMethod>PUT</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Run Code Online (Sandbox Code Playgroud)

根据支持团队的建议,将阻止所有公共访问设置为关闭。

我希望可以在浏览器中访问对象链接..(只读)

需要帮助配置存储桶?

amazon-s3 amazon-web-services

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