Use of Dialog.prompt service in Contacts module
parent
666d36736f
commit
e59a4b4246
|
@ -114,50 +114,20 @@
|
|||
$scope.editMode = false;
|
||||
$state.go('app.addressbook', {addressbookId: folder.id});
|
||||
};
|
||||
$scope.newAddressbook = function(ev) {
|
||||
$scope.editMode = false;
|
||||
$mdDialog.show({
|
||||
parent: angular.element(document.body),
|
||||
targetEvent: ev,
|
||||
clickOutsideToClose: true,
|
||||
escapeToClose: true,
|
||||
template:
|
||||
'<md-dialog aria-label="' + l('New addressbook') + '">' +
|
||||
' <md-dialog-content layout="column">' +
|
||||
' <md-input-container>' +
|
||||
' <label>' + l('Name of new addressbook') + '</label>' +
|
||||
' <input type="text" ng-model="name" required="required"/>' +
|
||||
' </md-input-container>' +
|
||||
' <div layout="row">' +
|
||||
' <md-button ng-click="cancelClicked()">' +
|
||||
' Cancel' +
|
||||
' </md-button>' +
|
||||
' <md-button ng-click="okClicked()" ng-disabled="!name.length">' +
|
||||
' OK' +
|
||||
' </md-button>' +
|
||||
' </div>'+
|
||||
' </md-dialog-content>' +
|
||||
'</md-dialog>',
|
||||
controller: NewAddressBookDialogController
|
||||
});
|
||||
function NewAddressBookDialogController(scope, $mdDialog) {
|
||||
scope.name = "";
|
||||
scope.cancelClicked = function() {
|
||||
$mdDialog.hide();
|
||||
}
|
||||
scope.okClicked = function() {
|
||||
$scope.newAddressbook = function() {
|
||||
Dialog.prompt(l('New addressbook'),
|
||||
l('Name of new addressbook'))
|
||||
.then(function(name) {
|
||||
var addressbook = new AddressBook(
|
||||
{
|
||||
name: scope.name,
|
||||
name: name,
|
||||
isEditable: true,
|
||||
isRemote: false,
|
||||
owner: UserLogin
|
||||
}
|
||||
);
|
||||
AddressBook.$add(addressbook);
|
||||
$mdDialog.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
$scope.edit = function(index, folder) {
|
||||
if (!folder.isRemote) {
|
||||
|
|
Loading…
Reference in New Issue