問題タブ [angular-template-form]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
angular - Typescript で「total」を計算し、「total=quantity*price」を更新します
私は次のようなものを計算したいと思います:そして、いつまたは変更total= quantity*price
を更新します。total
quantity
price
app.component.html
app.component.ts
quantity
またはを変更してもprice
、 では何も変化しませんtotal
。
誰かがアイデアを提案したり、私のコードの問題を説明したりできますか?
ありがとうございました
angular - TypeError:null angular 6のプロパティ 'postalCode'を読み取れません
私のアプリケーションでは、ユーザーの firstName、lastName、email、mobile、および password を取得します。ユーザー アカウント情報ページには、フィールド firstName、lastName、mobile、gender、email、street1、street2、province、suburb、postalCode が表示されます。アカウント情報ページに移動すると、firstName、lastName、email、mobile、gender のみが表示されます。登録したユーザーがすぐに API からデータを取得する方法は次のとおりです。
ただし、住所データがある場合、住所は属性内のオブジェクトとして表示されます。表示されていない各フィールドの div に *ngIf="model.address" を設定しました。隠しフィールドを表示する方法が必要です。1 つのフィールド (postalCode) から *ngIf="model.address" を削除すると、「TypeError: null のプロパティ "postalCode" を読み取れません」というエラーが発生します。私のテンプレートを以下に示します。
私の .ts ファイルは次のとおりです。
postalCode の div タグに *ngIf="model.address" を追加すると、エラーは発生しませんが、表示されません。