我正在嘗試創建兩個下拉下降與主題和另一個視頻。這些視頻將按照主題進行過濾。預先感謝您的幫助。角度級聯下拉
<md-input-container flex>
<label>Topic</label>
<md-select ng-model="selected.topic" required ng-change="getVideosByTopicId(selected.topic)">
<md-option ng-repeat="topic in topics" value="{{topic.TopicID}}">{{topic.TopicName}}</md-option>
</md-select>
</md-input-container>
<md-input-container flex>
<label>Video</label>
<md-select ng-model="selected.video" required >
<md-option ng-repeat="video in videos" value="{{video.VideoID}}">{{video.Name}}</md-option>
</md-select>
</md-input-container>
這是控制器
function getVideosByTopicId(topicId) {
return $http.post(baseUrl + 'Test/getVideosByTopicId', topicId).then(function (response) {
return $.parseJSON(response.data);
});
}
如果一切都很好,你的js代碼,然後分配給響應$ scope.videos在ng-repeat中使用 –