So I'm working on a project where there's a table of different instances of our service and each row has a info button that pulls up a form with info from the row autofilled into it.
The problem: By the time I get the value for the row, the page is already rendered so I can't seem to autofill the information.
What I want: When the form is shown, the input fields will be filled from the value inside the table for that row.
the code is shortened and I just wanted to post what was necessary.
Code:
InfoForm.html
<form name="info_change_request_form">
<div >
<md-input-container class="md-block">
<label>Name</label>
<input maxlength="255" type="text" name="name" ng-model="info_request.name" required="true"/>
</md-input-container class="md-block">
</div>
<div>
<md-input-container class="md-block">
<label>Email</label>
<input maxlength="255" type="email" name="email" ng-model="info_request.email" required="true"/>
</md-input-container class="md-block">
</div>
<div>
<md-input-container class="md-block">
<label>Summary</label>
<input maxlength="255" type="text" name="summary" ng-model="info_request.summary" rows="5" required="true"/>
</md-input-container class="md-block">
</div>
Table.html
<tbody md-body>
<tr md-row ng-repeat="info in infos">
<td md-cell></td>
<td md-cell></td>
<td md-cell>
<md-menu md-position-mode="target-right target" flex="50">
Controller.js
$scope.newInfoForm = function(info) {
// Build the confirm dialog
var confirm = $mdDialog.confirm({
controller: 'InfoController',
templateUrl: 'app/informationtables/info_change.html',
clickOutsideToClose: true,
parent: angular.element(document.body)
});
// Show confirm dialog and updates projects list
// Creation is called upon submitting the form (see create(project))
$mdDialog.show(confirm).finally(function() {
// TODO: callback?
});
};
Aucun commentaire:
Enregistrer un commentaire