angular.module('archie').directive('skeleton', function() { var localController = function ($scope, $rootScope, $timeout, $mdDialog, archieService, DTOptionsBuilder, DTColumnDefBuilder) { $scope.dtOptions = DTOptionsBuilder.newOptions().withPaginationType('full_numbers'); $scope.dtColumnDefs = [ //DTColumnDefBuilder.newColumnDef(1).notVisible(), DTColumnDefBuilder.newColumnDef(2).withTitle('Hand Thing') ]; //Local variables var resetArchie = { "Dimension": { "Uom": "Milliarchieops", "Height": null, "Width": null, "Length": null, "Girth": null, "WingHandValue": null }, "Skeleton": { "Wingbone": null, "HandThing": null, "Skull": null, "Teeth": null, "Feet": null, "Tail": null, "Spine": null }, "Location": { "Latitude": null, "Longitude": null }, "SpecimenName": null, "TotalWingSpan": 0 }; // Get UOM archieService.GetUom() .success(function (data) { $scope.Uom = data; $scope.ListDisplay = true; $scope.myArchie = angular.copy(resetArchie); }) .error(function (error) { $mdDialog.show( $mdDialog.alert() .title('Error') .content("Error getting GetUom") .ok('OK') ); }); // ng-click - Save payload $scope.Save = function () { console.log("================================"); console.log($scope.myArchie); console.log("================================"); archieService.SavePayload($scope.myArchie) .success(function (data) { //$scope.archie = data; $mdDialog.show( $mdDialog.alert() .title('Success') .content("Successfully Added") .ok('OK') ); $scope.myArchie = angular.copy(resetArchie); }) .error(function (error) { $mdDialog.show( $mdDialog.alert() .title('Error') .content(error.ExceptionMessage) .ok('OK') ); }); }; // ng-click - Display table $scope.Display = function () { archieService.GetAllArchies() .success(function (data) { $scope.archies = data; $scope.ListDisplay = !$scope.ListDisplay; }) .error(function (error) { $mdDialog.show( $mdDialog.alert() .title('Error') .content("Error posting PostPayload") .ok('OK') ); }); }; }; return { restrict: 'E', replace: true, scope: { }, templateUrl: 'archie/directive/skeleton/skeleton.html', link: function(scope, element, attrs, fn) { }, controller: localController }; });