nw-card.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. angular.module('NoteWrangler')
  2. .directive('nwCard', ['$sce', function($sce) {
  3. return {
  4. replace: true,
  5. restrict: "E",
  6. scope: {
  7. header: "=",
  8. body: "=",
  9. image: "=",
  10. icon: "@",
  11. id: "=",
  12. type: "@"
  13. },
  14. templateUrl: "templates/directives/nw-card.html",
  15. link: function(scope, element) {
  16. if(scope.body){
  17. scope.body = $sce.trustAsHtml(markdown.toHTML(scope.body.toString()));
  18. }
  19. }
  20. };
  21. }]);
  22. /*
  23. // In Level 3 Challenges, after they refactored the above and created a markdownFactory Service they will need to change the nwCard Directive to actually USE the Service.
  24. angular.module('NoteWrangler').directive('nwCard', ['markdown', '$sce', function(markdown, $sce) {
  25. return {
  26. replace: true,
  27. restrict: "E",
  28. scope: {
  29. title: "=",
  30. body: "=",
  31. image: "=",
  32. icon: "@",
  33. id: "=",
  34. type: "@"
  35. },
  36. templateUrl: "templates/directives/nw-card.html",
  37. link: function(scope, element) {
  38. scope.body = $sce.trustAsHtml(markdown.parse(scope.body));
  39. }
  40. };
  41. }]);
  42. */