以下是我的JSON數據。如何根據類別獲取subCategories angularjs
JSON
{
"1":{"id":"1","name":"Websites IT & Software","sub_cat":[
{"id":"1","name":"Build a Website","description":"Build a Website"},
{"id":"2","name":"Build an Online Store","description":"Build an Online Store"},
{"id":"3","name":"Get Traffic to my Website ","description":"Get Traffic to my Website "},
{"id":"4","name":"Write some Software","description":"Write some Software"},
{"id":"5","name":"Convert a Template to a Website","description":"Convert a Template to a Website"},
{"id":"53","name":"Create a Wordpress Template","description":"Create a Wordpress Template"},
{"id":"54","name":"Create a Joomla Template","description":"Create a Joomla Template"},
{"id":"55","name":"Create a Drupal Template","description":"Create a Drupal Template"},
{"id":"56","name":"Develop a Mac Application","description":"Develop a Mac Application"}
]},
"2":{"id":"2","name":"Mobile","sub_cat":[
{"id":"6","name":"Write an iPhone application","description":"Write an iPhone application"},
{"id":"7","name":"Write an iPad application","description":"Write an iPad application"},
{"id":"8","name":"Write a Blackberry application","description":"Write a Blackberry application"},
{"id":"9","name":"Write an Android application","description":"Write an Android application"},
{"id":"57","name":"Create a Mobile Website","description":"Create a Mobile Website"}]}}
所有我想要的是一個基於用戶選擇,我想實現的角度的方式同樣的事情類別獲取子類別。我是否需要再次創建一個Ajax以基於類別獲取子類別?
任何想法,我該如何做到這一點,將不勝感激。謝謝:)
你的意思是:如何訪問JSON鑰匙送過來AJAX? –
瀏覽角度文檔網站上的教程。將向您展示幾種可能的解決方案問題太廣了 – charlietfl
@DiegoGallegos不,我想取取sub_cat取決於類別用戶選擇 –