javascript - Angular cascading dropdowns -
i trying create 2 drop downs 1 topic , other 1 videos. videos 1 going filter topics. thank in advance help.
<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>
and controller
function getvideosbytopicid(topicid) { return $http.post(baseurl + 'test/getvideosbytopicid', topicid).then(function (response) { return $.parsejson(response.data); }); }
you can this,
<md-select ng-model="type" > <md-option ng-value="k" data-ng-repeat="(k,v) in videos">{{ k }}</md-option> </md-select> <md-select ng-model="metrics" > <md-option ng-value="t" data-ng-repeat="t in level2">{{ t }}</md-option> </md-select>
Comments
Post a Comment