我使用trianglejs和添加新项目的操作不正常,因为它没有更新表格,并且描述字段是未定义的
控制器
function AddServiceTypeDialogController(ServiceTypeResource,$mdDialog, $http, currentType) {
var vm = this;
vm.post = currentType;
ServiceTypeResource.getServiceTypes().then(function(response){
vm.ServiceTypeList=response.data.response;
console.log("ServiceTypeList",vm.ServiceTypeList);
});
vm.hide = function() {
$mdDialog.hide();
};
vm.cancel = function() {
$mdDialog.cancel();
};
// vm.NewServiceType=[];
vm.create = function() {
vm.NewServiceType=[];
var _service = {
Description:vm.NewServiceType.Description,
ProviderServiceTypeID:vm.ServiceTypeList.length + 1
};
console.log(_service);
vm.ServiceTypeList.push(_service);
clearModel();
console.log("ServiceTypeList",vm.ServiceTypeList);
// $http.post('http://138.197.195.46:3000/registerpartner', {
// account: '0xe99f7e5f1576dd2b535d2e8152be961138dfce10',
// name: vm.post.name,
// }).then(function(r) {
// if (r.status != 200) return;
// var db = firebase.database().ref('partner');
// db.push(vm.post);
// vm.post = {};
$mdDialog.hide();
// });
};
表格
<md-dialog aria-label="Add Partner" flex="60" flex-xs="90">
<form ng-cloak ng-submit="vm.create()" novalidate>
<md-dialog-content>
<div class="md-dialog-content">
<div layout="row" flex="100">
</div>
<md-input-container>
<input type="text" ng-model="vm.NewServiceType.Description" required md-maxlength="10">
</md-input-container>
</md-dialog-content>
<md-dialog-actions layout="row">
<md-button ng-click="vm.cancel()">CANCEL</md-button>
<md-button class="md-raised md-accent" ng-disabled="form.$invalid" type="submit">SAVE</md-button>
</md-dialog-actions>
</form>
</md-dialog>
此代码不更新表
<tri-table class="packages-table" columns="vm.columns" contents="vm.ServiceTypeList" page-size="5"></tri-table>
及其发送描述为未定义