Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用Angular Schema Form复选框布尔值处理onChange?_Javascript_Jquery_Angularjs_Angular Schema Form - Fatal编程技术网

Javascript 如何使用Angular Schema Form复选框布尔值处理onChange?

Javascript 如何使用Angular Schema Form复选框布尔值处理onChange?,javascript,jquery,angularjs,angular-schema-form,Javascript,Jquery,Angularjs,Angular Schema Form,我好像没法让这件事发生。我已经按照文档将该方法添加到代码中,但是什么也没有发生 $scope.schema = { "type": "object", "title": "Comment", "properties": { "comment": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "boo

我好像没法让这件事发生。我已经按照文档将该方法添加到代码中,但是什么也没有发生

 $scope.schema = {
"type": "object",
"title": "Comment",
"properties": {
  "comment": {
    "type": "array",
    "items": {
      "type": "object",
      "properties": {
        "name": {
          "type": "boolean",
          "title": "Name"
        },
        "eligible": {
          "type": "boolean",
          "title": "Eligible for awesome things"
        },
        "code": {
          "type":"boolean",
          "title": "The Code"
        }
      }
    }
  },
  "comment2": {
    "type": "boolean",
    "title": "Name"
  }
},
"required": [
  "comment"
]
};


$scope.form = [
{
  key: "comment",
  onChange: function(model, form){
    console.log('got there though');
  }
},
{
 type: "boolean",
 onChange: function(model, form){
   console.log('this');
 }
},
{
  type: "submit",
  title: "Save"
}
];

$scope.model = {};

看看这本书:

周五就把这本书看完了。我需要在表单定义中按键引用每个属性

参考更新的plunker:

 $scope.form = [
{
  key: 'comment',
  add: null,
  remove: null,
  title: false,
  notitle: true,
  items: 
  [
    {
      key: "comment.name",
      title: 'This',
      type: 'boolean',
      onChange: function(model, form){
        alert('got there ' + model.toString());
      }
    },
     {
      key: "comment.elgible",
      title: 'This',
      type: 'boolean',
      onChange: function(model, form){
        alert('got there though');
      }
    },
     {
      key: "comment.code",
      title: 'This',
      type: 'boolean',
      onChange: function(model, form){
        alert('got there though');
      }
    },
    ]
},

{
  type: "submit",
  title: "Save"
}
];