我正在尝试创建两个下拉下降与主题和另一个视频。这些视频将按照主题进行过滤。预先感谢您的帮助。角度级联下拉
<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中使用 –