The $http.post(url, dessert.comment); on save in the below code does't work.
$scope.editComment = function (event, dessert) {
// if auto selection is enabled you will want to stop the event
// from propagating and selecting the row
event.stopPropagation();
/*
messages is commented out because there is a bug currently
with ngRepeat and ngMessages were the messages are always
displayed even if the error property on the ngModelController
is not set, I've included it anyway so you get the idea
*/
var promise = $mdEditDialog.small({
// messages: {
// test: 'I don\'t like tests!'
// },
modelValue: dessert.comment,
placeholder: 'Add a comment',
save: function (input) {
dessert.comment = input.$modelValue;
$http.post(url, dessert.comment);
},
targetEvent: event,
validators: {
'md-maxlength': 30
}
});
promise.then(function (ctrl) {
var input = ctrl.getInput();
The $http.post(url, dessert.comment); on save in the below code does't work.
$scope.editComment = function (event, dessert) { // if auto selection is enabled you will want to stop the event // from propagating and selecting the row event.stopPropagation();
/*
is not set, I've included it anyway so you get the idea */
var promise = $mdEditDialog.small({ // messages: { // test: 'I don\'t like tests!' // }, modelValue: dessert.comment, placeholder: 'Add a comment', save: function (input) { dessert.comment = input.$modelValue; $http.post(url, dessert.comment); }, targetEvent: event, validators: { 'md-maxlength': 30 } });
promise.then(function (ctrl) { var input = ctrl.getInput();
input.$viewChangeListeners.push(function () { input.$setValidity('test', input.$modelValue !== 'test'); }); }); });