如果我点击按钮selectedFileSize
时没有为ng-model TypeError: Cannot read property 'size' of undefined
选择其投掷错误startRecording
的值。我该如何解决这个问题?
main.html中
<div class="col-md-3">
<select class="form-control" ng-model="selectedFileSize" ng-options="item as item.value for item in FileSizeOptions" ng-change="onSizeChange()"><option value="">Select</option></select>
</div>
<div class="col-md-2">
<button type="button" class="btn btn-primary" ng-click="startRecording()">Start Recording</button>
</div>
ctrl.js
if (($scope.selectedFileSize.size !== "") || ($scope.selectedFileSize !== undefined)) {
//logic here
}
答案 0 :(得分:2)
在检查a,b,c,d,e
a,b,c,d,e
a,b,c,d,e
a,b,c,d,e f g
a,b,c,d,e
:
selectedFileSize
selectedFileSize.size