2013-09-21 72 views

回答

11

更新HTML:

<div ng-controller="exerciseTypeCtrl"> 

<ul data-role="listview" data-inset="true" > 
<li> 
    <select id="exerciseSuperCategory" data-role="listview" ng-options="catagory as catagory.text for catagory in catagories.cast " ng-model="itemsuper" ng-change="changeData()"> 
    </select> 
</li> 
</ul>  
<ul data-role="listview" data-inset="true"> 
<li> 
    <select data-role="listview" ng-options="type as type.text for type in types.cast " ng-model="item1" ng-change="update()"> 

    </select> 
</li> 
</ul> 

更新控制器:

myApp.controller('exerciseTypeCtrl',function($scope,indoors,outdoors,setNulls, catagories){ 

$scope.catagories = catagories; 
$scope.types = setNulls; 
$scope.changeData = function() { 
    //console.log($scope.itemsuper); 

    if($scope.itemsuper.text == "Indoor") { 
     $scope.types = indoors; 
    } else if($scope.itemsuper.text == "Outdoor") { 
     $scope.types = outdoors; 
    } else { 
     $scope.types = setNulls; 
    } 
} 
}); 

Updated Example

+0

感謝您的答覆是,我需要 感謝您的關注正確的方法 – Blu

+0

這是我的榮幸 –

相關問題