【发布时间】:2016-02-27 04:01:17
【问题描述】:
我正在尝试使用 ngoptions 和 ngchange 验证选择下拉列表中的内容。 例如,如果选中的内容是“票”,那么它将显示提交按钮。
目前,在我看来(前端)有 Jade:
Select(ng-model='angReporting' ng-options="r.reporting for r in
incategory" style="width:100px;" ng-change="ifChange(angReporting)" )
br
a.btn.btn-primary.btn-sm(ng-click="incidentsCreate()" ng-hide="validate(status)")
Submit
以上是一个简短的示例,我有一组链式选择(angularjs)正在工作。 为了验证是否选择了正确的内容,我的模块上有以下内容:
$scope.itemList=[];
$scope.ifChange=function(item){
$scope.itemList.push(item.reporting);
for (var i=0; i < $scope.itemList.length; i++){
if($scope.itemList[i] === 'Ticket'){
$scope.validate = {status: false};
}
}
};
范围的 json 内容简而言之:
$scope.incategory = [
{
'reporting':'Incident',
'content':[
{
...
}
'reporting':'Ticket',
'content':[
{
...
}
提前感谢您分享您的想法 最好的问候
【问题讨论】:
标签: json node.js angularjs-scope pug mean-stack