我有以下json:
[
{
"normal" :{
"font": "Burlington Script.ttf",
"fontFamily": "sf_burlington_scriptregular",
"fontName": "Burlington Script"
},
"bold" : {
"font": "SF_Burlington_Script_Bold.ttf",
"fontFamily": "sf_burlington_scriptbold",
"fontName": "Burlington Script"
},
"italic" : {
"font": "SF_Burlington_Script_Italic.ttf",
"fontFamily": "sf_burlington_scriptitalic",
"fontName": "Burlington Script"
},
"bold-italic": {
"font": "SF_Burlington_Script_Bold_Italic.ttf",
"fontFamily": "sf_burlington_scriptBdIt",
"fontName": "Burlington Script"
}
},
{
"normal" :{
"font": "Some_Script.ttf",
"fontFamily": "Some_scriptregular",
"fontName" : "Some Script"
},
"bold" : {
"font": "Some_Script_Bold.ttf",
"fontFamily": "Some_scriptbold",
"fontName" : "Some Script"
},
"italic" : {
"font": "Some_Script_Italic.ttf",
"fontFamily": "Some_scriptitalic",
"fontName" : "Some Script"
},
"bold-italic": {
"font": "Some_Script_Bold_Italic.ttf",
"fontFamily": "Some_scriptBdIt",
"fontName" : "Some Script"
}
}
]
我想要做的是仅在“正常”下的下拉列表中显示 fontName,并将值设为 fontFamily。
我试过了
<select
ng-model="selectedFont"
ng-options="fonts as fonts.normal.fontName for fonts in designFonts" required>
</select>
但没有运气。我在我的控制器中将 $scope.designFonts 设置为 json 是什么。