2016-08-31 4 views
0

ich diese Jade Vorlage für modalen Dialog mit Winkel Material habe (konnte nicht in HTML umwandeln, weil die jade site nicht funktioniert):Naming TextArea- schafft keine Instanz in Form der Winkel

md-dialog(aria-label='Reject', ng-cloak='') 
    form(name="rejectionForm") 
    md-dialog-content 
     .md-dialog-content 
     h2.md-title Reject confirmation for 
     div(ng-bind-html="vm.parent.task.label") 
     div {{rejectionForm | json}} 
     textarea(placeholder="Please provide a reason for rejection", name="reason", style="width: 530px; height: 75px", ng-required="true") 
     div(ng-messages="rejectionForm.reason.$error") 
      div(ng-message="required") You need to give the reason 
    md-dialog-actions(layout="row") 
     span(flex) 
     md-button(ng-click="vm.parent.cancel()") CANCEL 
     md-button.md-primary.md-raised(ng-click="vm.parent.reject()", ng-disabled="rejectionForm.$invalid") REJECT 

es schaffen soll Instanz des Formularfeldes in rejectionForm genannt reason aber die resultierende json wie folgt aussehen:

{ 
    "$error": {}, 
    "$name": "rejectionForm", 
    "$dirty": false, 
    "$pristine": true, 
    "$valid": true, 
    "$invalid": false, 
    "$submitted": false 

}

warum Es gibt keine reason und warum ist mein Formular nicht validiert?

Antwort

1

Sofern Sie ng-model über input Element mit name Attribut Form haben, wäre es nicht, dass name Eigenschaft in rejectionForm Form Objekt hinzufügen.

Sie sollten ng-model="something" eingeben, um reason erhalten innerhalb rejectionForm Formular ausgefüllt werden.