Câu hỏi được gắn thẻ «angular»

Các câu hỏi về Angular (đừng nhầm với AngularJS), khung web từ Google. Sử dụng thẻ này cho các câu hỏi góc không dành riêng cho một phiên bản riêng lẻ. Đối với khung web AngularJS (1.x) cũ hơn, hãy sử dụng thẻ angularjs.




8
Angular 2 Không thể tìm thấy điều khiển có thuộc tính tên không xác định trên formArrays
Tôi đang cố gắng lặp lại formArray trong thành phần của mình nhưng tôi gặp lỗi sau Error: Cannot find control with unspecified name attribute Đây là logic trông như thế nào trên tệp lớp của tôi export class AreasFormComponent implements OnInit { public initialState: any; public areasForm: FormGroup; constructor(private …

9
Trong Angular 2 làm thế nào để kiểm tra xem <ng-content> có trống không?
Giả sử tôi có một thành phần: @Component({ selector: 'MyContainer', template: ` &lt;div class="container"&gt; &lt;!-- some html skipped --&gt; &lt;ng-content&gt;&lt;/ng-content&gt; &lt;span *ngIf="????"&gt;Display this if ng-content is empty!&lt;/span&gt; &lt;!-- some html skipped --&gt; &lt;/div&gt;` }) export class MyContainer { } Bây giờ, tôi muốn hiển thị một số nội dung mặc …



4
Cách chuyển 2 tham số cho EventEmitter angle2
Tôi có trong thành phần của mình một an EventEmitternhưng tôi không thể biên dịch nó vì nó trả về lỗi: Supplied parameters do not match any signature of call target Thành phần của tôi: @Output() addModel = new EventEmitter&lt;any&gt;(); saveModel($event, make, name) { this.addModel.emit(make, name); } Nếu tôi xóa …

4
Sử dụng một mảng từ Đối tượng có thể quan sát với ngFor và Async Pipe Angular 2
Tôi đang cố gắng hiểu cách sử dụng Observables trong Angular 2. Tôi có dịch vụ này: import {Injectable, EventEmitter, ViewChild} from '@angular/core'; import {Observable} from "rxjs/Observable"; import {Subject} from "rxjs/Subject"; import {BehaviorSubject} from "rxjs/Rx"; import {Availabilities} from './availabilities-interface' @Injectable() export class AppointmentChoiceStore { public _appointmentChoices: BehaviorSubject&lt;Availabilities&gt; = new BehaviorSubject&lt;Availabilities&gt;({"availabilities": …


9
Angular2 - Tham số yêu cầu Http POST
Tôi đang cố gắng thực hiện một yêu cầu ĐĂNG nhưng tôi không thể làm cho nó hoạt động: testRequest() { var body = 'username=myusername?password=mypassword'; var headers = new Headers(); headers.append('Content-Type', 'application/x-www-form-urlencoded'); this.http .post('/api', body, { headers: headers }) .subscribe(data =&gt; { alert('ok'); }, error =&gt; { console.log(JSON.stringify(error.json())); }); } …

5
Angular2 không thể liên kết với DIRECTIVE vì nó không phải là một thuộc tính đã biết của phần tử
Tôi đã tạo @Directive mới bằng Angular CLI, nó đã được nhập vào app.module.ts của tôi import { ContenteditableModelDirective } from './directives/contenteditable-model.directive'; import { ChatWindowComponent } from './chat-window/chat-window.component'; @NgModule({ declarations: [ AppComponent, ContenteditableModelDirective, ChatWindowComponent, ... ], imports: [ ... ], ... }) và tôi cố gắng sử dụng trong thành …

3
onchange tương đương trong angle2
tôi đang sử dụng onchange để lưu giá trị của phạm vi đầu vào của mình vào firebase, nhưng tôi gặp lỗi khi nói rằng hàm của tôi không được xác định. đây là chức năng của tôi saverange(){ this.Platform.ready().then(() =&gt; { this.rootRef.child("users").child(this.UserID).child('range').set(this.range) }) } đây là html của tôi …
91 angular 

3
Không thể liên kết với 'aria-valuenow' vì nó không phải là thuộc tính đã biết của 'div'
Có gì sai với đoạn mã sau? Tôi rất vui khi tôi cố gắng gán một biểu thức cho một phần tử, &lt;div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="{{MY_PREC}}" aria-valuemin="0" aria-valuemax="100" &gt; {{MY_PREC}} &lt;/div&gt; cũng đã cố gắng như [aria-valuenow]={{MY_PREC}} Có vẻ như nó xảy ra kể từ RC5 bất kỳ …
91 angular 


Khi sử dụng trang web của chúng tôi, bạn xác nhận rằng bạn đã đọc và hiểu Chính sách cookieChính sách bảo mật của chúng tôi.
Licensed under cc by-sa 3.0 with attribution required.