2016-08-22 12:59:56 +02:00

99 lines
3.1 KiB
JavaScript

// Controller of defaultUserInterface.
appControllers.controller('defaultUserInterfaceCtrl', function ($scope, $mdBottomSheet, $mdToast, $mdDialog) {
//Default value of input number.
$scope.inputNumber = 0;
//Default value of dialog.
$scope.dialogResult = "";
//Default value of Selection.
$scope.mdSelectValue = "0";
//Default value of switch.
$scope.switchData = {
switchNormal: "Please change me",
switchNoInk: false
};
//Default value of radio data.
$scope.radioData = {fruit: 0};
// For show show List Bottom Sheet.
$scope.showListBottomSheet = function ($event) {
$mdBottomSheet.show({
templateUrl: 'ui-list-bottom-sheet-template',
targetEvent: $event,
scope: $scope.$new(false),
});
};// End of showListBottomSheet.
// For show Grid Bottom Sheet.
$scope.showGridBottomSheet = function ($event) {
$mdBottomSheet.show({
templateUrl: 'ui-grid-bottom-sheet-template',
targetEvent: $event,
scope: $scope.$new(false),
});
};// End of showGridBottomSheet.
// For show toast.
$scope.showToast = function (toastPosition) {
$mdToast.show({
controller: 'toastController',
templateUrl: 'toast.html',
hideDelay: 800,
position: toastPosition,
locals: {
displayOption: {
title: 'Action Toast'
}
}
});
}; // End of showToast.
// For close list bottom sheet.
$scope.closeListBottomSheet = function () {
$mdBottomSheet.hide();
} // End of closeListBottomSheet.
// For do something in this function.
$scope.doSomeThing = function () {
// you can put any function here.
}// Emd of doSomeThing
// For show Confrim Dialog.
$scope.showConfirmDialog = function ($event) {
$mdDialog.show({
controller: 'DialogController',
templateUrl: 'confirm-dialog.html',
targetEvent: $event,
locals: {
displayOption: {
title: "Confirm dialog ...?",
content: "This is confirm dialog content.",
ok: "Confirm",
cancel: "Close"
}
}
}).then(function () {
$scope.dialogResult = "You choose Confirm!"
}, function () {
$scope.dialogResult = "You choose Close !!"
});
}// End showConfirmDialog.
// For show alert Dialog.
$scope.showAlertDialog = function ($event) {
$mdDialog.show({
controller: 'DialogController',
templateUrl: 'confirm-dialog.html',
targetEvent: $event,
locals: {
displayOption: {
title: "Alert dialog !!",
content: "This is alert dialog content.",
ok: "Confirm"
}
}
}).then(function () {
$scope.dialogResult = "You choose Confirm!"
});
}// End showAlertDialog.
}); // End of defaultUserInterface controller.