Advertisement
suthagar23

q1

Aug 14th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1.  
  2. var app = angular.module('Tag',['tagService','ngDialog','uicommons.common.error']);
  3.  
  4.  
  5. app.controller('tagCtrl',['$scope','TagService','ngDialog',
  6. function ($scope,TagService,ngDialog) {
  7.  
  8. $scope.persionUuid='';
  9. $scope.setPersonUuid = function(uuid){
  10. $scope.persionUuid = uuid;
  11. }
  12. // then call data-ng-init="setPersonUuid ($id)" in the view
  13.  
  14. function loadTags(personUuid) {
  15. var payload = {
  16. objectType: 'org.openmrs.Person',
  17. objectUuid: personUuid
  18. };
  19. TagService.getTags(payload).then(function (res) {
  20. $scope.tags = res;
  21. });
  22. };
  23.  
  24. $scope.showDialog = function(tag, personUuid) {
  25. ngDialog.openConfirm({
  26. showClose: false,
  27. closeByEscape: true,
  28. closeByDocument: true,
  29. data: tag,
  30. template: 'dialogTemplate'
  31. }).then(function() {
  32. TagService.deleteTag(tag).then(function (res) {
  33. loadTags(personUuid);
  34. })
  35. });
  36. };
  37.  
  38.  
  39.  
  40. .......
  41. }
  42.  
  43.  
  44.  
  45. when you are calling $scope.showDialog() pass the tag and ${ patient.patient.uuid }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement