我正在尝试检查md-select中的更改,但我无法使用$dirty
<div class="resourceForm" ng-form="resForm{{$index}}">
<md-select name="resourceAllocForm" id="id{{resourceContent.activityId}}-{{x}}" ng-model="selRes[$parent.$index][x]" placeholder="Select Resource" class="md-no-underline" ng-keyup="resourceCheck($parent.$index)">
<md-option ng-value="resource.id" ng-repeat="resource in resourceList track by resource.id">{{resource.roleProLabel}}</md-option>
</md-select>
</div>
我尝试过这样的事情
$timeout(function(parentIndex){
$scope.resourceAllocForm['resForm' + parentIndex].$dirty;
console.log('Form Edited');
}
答案 0 :(得分:1)
你需要这样的东西,
<md-select ng-change="show(resource)" ng-model="selectedresource">
<md-option ng-repeat="resource in resourceList track by resource.id" value="{{resource.id"}}">{{resource.roleProLabel}}
</md-option>
<md-select>
并在控制器中
$scope.show = function(resource){
console.log(show);
}