ProWorks Blog

How to find if Umbraco 7 Debugging is Enabled in AngularJS or Javascript in the Backoffice

By  |  Saturday, June 07, 2014  |  , , ,  |  72 comments

When creating a new functionality in the Umbraco 7 backoffice such as a property editor or custom section, it is sometimes necessary to print out some debugging information to verify that the models are what you expect.

Rather than commenting out your {{myModel | json}} AngularJS bindings, why not simply only show them if Umbraco has debugging turned on?

Turns out, this is very easy as Umbraco already has a global ServerVariables collection that you can check:

Umbraco.Sys.ServerVariables.isDebuggingEnabled

If you want to show/hide information based on that in AngularJS, simply assign it to a property on the $scope of your controller:

$scope.showDebug = Umbraco.Sys.ServerVariables.isDebuggingEnabled;

Then check for it in your view:

<div data-ng-show="showDebug">{{myModel | json}}</div>

That's it!  

72 comments for “How to find if Umbraco 7 Debugging is Enabled in AngularJS or Javascript in the Backoffice”

  1. Posted 7/29/2014 at 2:10:49 PM

    Hello!

  2. Posted 7/29/2014 at 2:11:01 PM

    Hello!

  3. Posted 7/29/2014 at 2:11:14 PM

    Hello!

  4. Posted 7/29/2014 at 2:11:27 PM

    Hello!

  5. Posted 7/30/2014 at 1:58:14 PM

    Hello!

  6. Posted 7/30/2014 at 1:58:28 PM

    Hello!

  7. Posted 7/30/2014 at 1:58:43 PM

    Hello!

  8. Posted 7/30/2014 at 1:58:57 PM

    Hello!

  9. Posted 7/31/2014 at 11:20:24 PM

    Hello!

  10. Posted 7/31/2014 at 11:20:37 PM

    Hello!

  11. Posted 7/31/2014 at 11:20:48 PM

    Hello!

  12. Posted 7/31/2014 at 11:21:00 PM

    Hello!

  13. Posted 7/31/2014 at 11:21:12 PM

    Hello!

  14. Posted 8/1/2014 at 1:29:34 AM

    Hello!

  15. Posted 8/1/2014 at 1:29:46 AM

    Hello!

  16. Posted 8/1/2014 at 1:29:58 AM

    Hello!

  17. Posted 8/1/2014 at 1:30:09 AM

    Hello!

  18. Posted 8/1/2014 at 2:27:27 PM

    Hello!

  19. Posted 8/1/2014 at 2:27:39 PM

    Hello!

  20. Posted 8/1/2014 at 2:27:50 PM

    Hello!

  21. Posted 8/1/2014 at 2:28:01 PM

    Hello!

  22. Posted 8/4/2014 at 5:18:24 AM

    Hello!

  23. Posted 8/4/2014 at 5:18:36 AM

    Hello!

  24. Posted 8/4/2014 at 5:18:49 AM

    Hello!

  25. Posted 8/4/2014 at 5:19:03 AM

    Hello!

  26. Posted 8/5/2014 at 8:49:25 AM

    Hello!

  27. Posted 8/5/2014 at 8:49:39 AM

    Hello!

  28. Posted 8/5/2014 at 8:49:54 AM

    Hello!

  29. Posted 8/5/2014 at 8:50:08 AM

    Hello!

  30. Posted 8/5/2014 at 8:50:24 AM

    Hello!

  31. Posted 8/6/2014 at 3:09:03 PM

    Hello!

  32. Posted 8/6/2014 at 3:09:18 PM

    Hello!

  33. Posted 8/6/2014 at 3:09:32 PM

    Hello!

  34. Posted 8/6/2014 at 3:09:45 PM

    Hello!

  35. Posted 8/6/2014 at 3:09:59 PM

    Hello!

  36. Posted 8/11/2014 at 6:53:29 PM

    Hello!

  37. Posted 8/11/2014 at 6:53:43 PM

    Hello!

  38. Posted 8/11/2014 at 6:53:56 PM

    Hello!

  39. Posted 8/11/2014 at 6:54:09 PM

    Hello!

  40. Posted 8/15/2014 at 5:05:23 AM

    Hello!

  41. Posted 8/15/2014 at 5:05:34 AM

    Hello!

  42. Posted 8/15/2014 at 5:05:45 AM

    Hello!

  43. Posted 8/15/2014 at 5:05:56 AM

    Hello!

  44. Posted 8/15/2014 at 10:02:38 AM

    Hello!

  45. Posted 8/15/2014 at 10:02:49 AM

    Hello!

  46. Posted 8/15/2014 at 10:03:01 AM

    Hello!

  47. Posted 8/15/2014 at 10:03:12 AM

    Hello!

  48. Posted 8/15/2014 at 10:03:23 AM

    Hello!

  49. Posted 8/15/2014 at 2:08:48 PM

    Hello!

  50. Posted 8/15/2014 at 2:08:59 PM

    Hello!

  51. Posted 8/15/2014 at 2:09:11 PM

    Hello!

  52. Posted 8/15/2014 at 2:09:22 PM

    Hello!

  53. Posted 8/15/2014 at 2:09:34 PM

    Hello!

  54. Posted 8/15/2014 at 9:02:19 PM

    Hello!

  55. Posted 8/15/2014 at 9:02:31 PM

    Hello!

  56. Posted 8/15/2014 at 9:02:44 PM

    Hello!

  57. Posted 8/15/2014 at 9:02:55 PM

    Hello!

  58. Posted 8/18/2014 at 4:55:01 AM

    Hello!

  59. Posted 8/18/2014 at 4:55:12 AM

    Hello!

  60. Posted 8/18/2014 at 4:55:24 AM

    Hello!

  61. Posted 8/18/2014 at 4:55:36 AM

    Hello!

  62. Posted 8/18/2014 at 4:55:47 AM

    Hello!

  63. Posted 8/19/2014 at 4:54:12 AM

    Hello!

  64. Posted 8/19/2014 at 4:54:24 AM

    Hello!

  65. Posted 8/19/2014 at 4:54:36 AM

    Hello!

  66. Posted 8/19/2014 at 4:54:48 AM

    Hello!

  67. Posted 8/19/2014 at 4:54:59 AM

    Hello!

  68. Posted 8/21/2014 at 1:19:32 AM

    Hello!

  69. Posted 8/21/2014 at 1:19:47 AM

    Hello!

  70. Posted 8/21/2014 at 1:20:00 AM

    Hello!

  71. Posted 8/21/2014 at 1:20:14 AM

    Hello!

  72. Posted 8/21/2014 at 1:20:27 AM

    Hello!

Post a comment