new jQuery Tmpl plugin doesn't seem to like namespaced functions
but I am hitting a brick wall on something:
I always group my JS stuff into objects to avoid any chance of name collision, as an example I would do something like :
- var NS = {};
- NS.Display = function($data, key) {
- return $data[key];
- };
- // I normally WOULD NOT do this
- function GlobalDisplayFunction($data, key) {
- return $data[key];
- };
etc etc....
the Template plugin says you can use an expression to generate output:
For more complex expressions it is preferable to place the expression within a function, then use
${myFunction(a,b)}
to call the function, as in:
so my template could have:
- <li>${GlobalDisplay($data, 'Value')}</li>
and that works as the documentation says it should
but if I try to leverage my namespaced function, the template engine just crashes... full stoppage of JavaScript execution
- <li>${NS.Display($data, 'Value')}</li>
I've got a full example posted here on JSBin (
run /
edit)
Hoping to get some resolution on this... I stay away from polluting the global namespace as much as humanly possible
Thanks in advance