ウェブサイト検索
私のページには以下のコードがあり、WEB APIからファイルをアップロードしようとしています。formDataにファイルのデータを渡してWEB APIに送信することは試しましたが、formDataで送信されたファイルをどのように読み取るかはわかりません。
AngularからWEB APIにファイルを送信するにはどうすればよいですか、そしてAPIでそれらをどのように読み取ることができますか?
Angular2 フロントエンド部分
<input #fileInput type="file"/> <button (click)="addFile()">
続きを読む →Angular 4アプリケーションを開発していると、生成されたファイルだけが記載されている読めないコールスタックがよく表示されます。こんな感じです:
ERROR TypeError: _co.archive is undefined Trace de la pile : View_UploadScriptFormComponent_0/<@ng:///AppModule/UploadScriptFormComponent.ngfactory.js:346:9 debugUpdateRenderer@http://localhost:4200/vendor.bundle.js:67835:12 checkAndUpdateView@http://localhost:4200/vendor.bundle.js:66982:5 callViewAction@http://localhost:4200/vendor.bundle.js:67342:21 execComponentViewsAction@http://localhost:4200/vend 続きを読む →
私はAngularのウェブサイトで提供されているチュートリアルを試しています。行き詰まってしまい、問題を解決することができません。
私はAngular CLIを使ってプロジェクトを作成しました。
app.component.ts
import { Component } from '@angular/core'; import {Hero} from './hero'; const HEROES: Hero[] = [ { id: 11, name: 'Mr. Nice' }, { id: 12, name: 'Narco' }, { id: 13, name: 'Bombasto' }, { id: 14, name: 'Celeritas' }, { id: 15, name: 'Magneta' }, { id: 16, name: 'RubberMan' }, { id: 17, name: 'Dynama' }, { id: 18, 続きを読む →TypeError: 未定義のプロパティ 'length' を読み取ることができません
コンソールログ
Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at createSourceFile (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15457:109) at parseSourceFileWorker (c:\Users\Amina\Desktop\LendingTree\node_modules\typescript\lib\typescript.js:15389:26) at Object.parseSourceFile (c:\Users\Amina\Desktop\LendingTree\node_modules\t 続きを読む →
自分で書いたカスタムJSが入ったjsファイルを読み込みたいです。このカスタムJSはjQueryを必要とします。jQueryの後に自分のjsファイルを読み込みたいのですが、どうすればよいですか。このスクリプトファイルをindex.htmlに入れたくありません。なぜなら、それだとすべてのコンポーネントと一緒に読み込まれてしまうからです。
これは私のjsファイルです
<!doctype html> <html lang="en"> <head> <met 続きを読む →Angular アプリを ng serve で実行するときの時間:
86% hashingcrypto.js:74 this._handle.update(data, encoding); ^ TypeError: Data must be a string or a buffer私は使用します:
node version : 6.11.3 npm version : 3.10.10 angular : 4こんにちは。TypeError: Data must be a String or Buffer に関するあなたの質問を読みました。Node を 6.11.3 から 7.4.0 に、また npm を最新バージョンにアップデートしてください。これで問題は解決すると思います。また、誤ったインポートが行われていないかも確
続きを読む →トークンを更新したいです。インターセプターを使用しています:
アプリ.interceptor.ts
import { Observable } from 'rxjs'; import { Injectable, Inject, Injector } from '@angular/core'; import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest, HttpResponse, HttpErrorResponse } from '@angular/common/http'; import { UserService } from "./user/services/user.service"; @Injectable() export class AngularInterceptor implements HttpInterceptor { public userService; constructor(private injector: Injector) 続きを読む →
これは私の質問です:
私は ngModel を内部に持つテンプレートを持ったカスタムコンポーネントがあります。
import { Component, Input, forwardRef } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; const listaMesi = [ { value: '01', text: 'Gennaio' }, { value: '02', text: 'Febbraio' }, { v
続きを読む →私はionicとangular(あるいはJavaScript自体も)に初心者です。サーバーから送信されるアンケートにユーザーが回答する、メッセージングアプリでの動的フォームを実現しようとしています。私のHTMLとTypeScriptのスニペットは以下の通りです。
initForm() { // this.pollForm = this.formBuilder.group({ // question: '', // options: '', // polls: this.formBuilder.array([ this.createPoll() ]) // }); // let allPolls: FormArray = new FormArray([]); // for (let i = 0; i < this.messageList.length; i++){ // let formGroup = new FormGroup({}); // if (this
続きを読む →
次のエラー処理関数があります:
handleError(error) { this.loading = false; console.log(error); let errorMessage; if (error.error && error.error.detail) { errorMessage = error.error.detail; } else { errorMessage = error.status + ': ' + error.statusText; } this._snackbar.open("Error: " + errorMessage, 'OK'); }私がそれを使っている方法はこちらです:
this._apiService.stop(this.element.id).subscribe(element => { this.element = elemen 続きを読む →