2017-01-31 3 views
3

나는 다음과 같은 출력을 생성 형성한다 (A 섹션) 구축하려는 :각 스키마 형태의 기본, 숨겨진 값

{ 
    ... 
    offers: { 
    context: "http://schema.org", 
    minPrice: 3 
    } 
    ... 
} 

캐치는, context이 항상 존재한다을 - 유일한 필드를 사용자가 조작하게되면 minPrice입니다. 즉시 가치있는 숨겨진 필드가 떠오릅니다. 여기에 양식 정의

$scope.schema = { 
    ... 
    offers: { 
    type: 'object', 
    properties: { 
     minPrice: { 
     type: 'number' 
     } 
    } 
    } 
    ... 
}; 

그리고 :

$scope.form = [ 
    ... 
    { 
    key: 'offers', 
    type: 'fieldset', 
    items: [ 
     { 
     key: 'offers.minPrice', 
     type: 'number' 
     }, 
     { 
     key: 'offers.context', 
     type: 'hidden', 
     default: 'http://schema.org' 
     } 
    ] 
    } 
    ... 
]; 

그러나, 그것은 분명 생성 된 모델을 관찰하는 항목 context가 존재하지 그래서 여기 스키마 정의입니다. type: 'hidden'default의 조합을 tabarray과 함께 사용했지만 성공적으로 object으로 가져올 수 없습니다. 이 글을 쓰고있는 시점에 0.8.13angular-schema-forms입니다.

감사의 말씀 감사드립니다.

답변

0

컨텍스트를 포함해야하며 해당 버전의 스키마 내에 기본값이 있어야합니다.

나는 문제가 이 v1.0.0 개발자의 알파에서 수정 된해야 버그에 관련된 것으로 기대

그것은 작동한다 :

스키마

{ 
    "type": "object", 
    "properties": { 
    "offers": { 
     "type": "object", 
     "properties": { 
     "minPrice": { 
      "type": "number" 
     }, 
     "context": { 
      "type": "string", 
      "default": "http://schema.org" 
     } 
     } 
    } 
    } 
} 

서식

[ 
    { 
    "type": "fieldset", 
    "items": [ 
     { 
     "key": "offers.minPrice", 
     "type":"number" 
     }, 
     { 
     "key": "offers.context", 
     "type": "hidden", 
     "notitle": true 
     } 
    ] 
    } 
]