問題タブ [viewchild]

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.

0 投票する
1 に答える
1893 参照

angular - テンプレート解析エラー: 参照 "#XXX" が angular で複数回定義されています

でクエリを実行するために、同じ名前のテンプレート参照変数を使用したいと考えています@ViewChildren

メタデータのプロパティ:

selector - クエリに使用されるディレクティブ タイプまたは名前。
read - クエリされた要素から別のトークンを読み取ります。

しかし、テンプレート解析エラーが発生しました:

サンプル:

質問:
1. テンプレート内で同じ名前のテンプレート参照変数を定義できますか? 2.名前を個別に定義せずに、同じセレクター
を使用して複数の要素を照会する方法は?