Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. template: '<span class="cite-text" [citable]="citableForCitation()">{{citationText}}</span>',
  2.  
  3. Attribute [citable] in not allowed here
  4.  
  5. template: '<span class="cite-text">{{citationText}}</span>',
  6.  
  7. <citation bentry=1>[Lin92]</citation>
  8.  
  9. library citation_component;
  10.  
  11. import 'dart:html';
  12. import 'package:angular/angular.dart';
  13. import 'package:angular_forms/angular_forms.dart';
  14.  
  15. import 'package:citable/citable/citable.dart' show CitableModel;
  16.  
  17. @Component(
  18. selector: 'citation',
  19. template: '<span class="cite-text" [citable]="citableForCitation()">{{citationText}}</span>',
  20. styleUrls: const ['citation.css'],
  21. directives: const [formDirectives, 'citableForCitation'])
  22.  
  23. class CitationComponent
  24. {
  25. @Input() int bentry;
  26. //@NgAttr('bentry')
  27. //int bentry;
  28.  
  29. // Set up the decorator
  30. static final citable = new Expando<CitableModel>();
  31.  
  32. final Element element;
  33. String citationText;
  34.  
  35. CitationComponent(this.element)
  36. {
  37. citationText = element.innerHtml;
  38. }
  39.  
  40. CitableModel citableForCitation()
  41. {
  42. if (citable[this] == null)
  43. {
  44. citable[this] = new CitableModel(bentry);
  45. }
  46. return citable[this];
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement