0
我已將[String, List[String]]
的地圖傳遞給Play中的一個視圖。用戶正在從下拉列表中選擇一個值。這個值是我的地圖中的一個關鍵。我正在使用此密鑰,然後使用地圖中的值填充第二個下拉列表 - String
的列表。但是,我不知道如何使用Play的模板語言從我的地圖中獲取值,因爲我正在通過JavaScript檢索密鑰。在Scala Play框架視圖中使用密鑰獲取地圖值
這是我的代碼:
function selectSubCat() {
var key = $("#monthYear").find(":selected").text(); // get the selected option's text. This is the map key.
// Here lies the issue. mailingRunDates is the name of the map I've passed to the view. Play says: val key not found.
var runDatesList = @mailingRunDates(key)