Advertisement
Guest User

Untitled

a guest
May 5th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. interface IDirectoryLink
  2. {
  3. link_title: string
  4. link_desc: string
  5. }
  6.  
  7. class DirectoryModel implements IDirectoryLink
  8. {
  9.  
  10. public link_title: string
  11. public link_desc: string
  12.  
  13. constructor(fields: Object)
  14. {
  15. // Loops to populate class properties with fields values
  16. _.forOwn(fields, (value, key) => // Needs fat arrow to bind 'this'
  17. {
  18. if (value) { this[key] = value }
  19. })
  20. }
  21. }
  22.  
  23. let directoryModel: IDirectoryLink = new DirectoryModel(fields)
  24.  
  25. let val = validation.modelValidator(directoryModel)
  26.  
  27. export let modelValidator = function (directoryModel: IDirectoryLink) // cannot find name IDirectoryLink
  28. {
  29. //code
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement