nw-card.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. scope.body = $sce.trustAsHtml(markdown.toHTML(scope.body.toString()));
  17. }
  18. };
  19. }]);
  20. /*
  21. // 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.
  22. angular.module('NoteWrangler').directive('nwCard', ['markdown', '$sce', function(markdown, $sce) {
  23. return {
  24. replace: true,
  25. restrict: "E",
  26. scope: {
  27. title: "=",
  28. body: "=",
  29. image: "=",
  30. icon: "@",
  31. id: "=",
  32. type: "@"
  33. },
  34. templateUrl: "templates/directives/nw-card.html",
  35. link: function(scope, element) {
  36. scope.body = $sce.trustAsHtml(markdown.parse(scope.body));
  37. }
  38. };
  39. }]);
  40. */