Aria Templates – Warning of “expression is null or undefined” in debug mode for a template file-Collection of common programming errors

In Aria Templates, whatever is done inside a TPL file should produce some output.

The warning is to notify you that there might be an issue in your code, because

  • you’re calling a function that doesn’t return (maybe you forgot to return)
  • you’re using undefined variables
  • you’re calling methods that are not used for producing markup

The latter is more a design issue, methods that are not related to the view should be called in other places ($dataReady/$afterRefresh and so on)

If you’re fine with methods returning undefined you can either

  • modify your method to return an empty string
  • use eat or empty template modifier

    ${( function() { console.log(“passed”); } )()|eat}

Originally posted 2013-11-09 23:32:39.