How to write confusing angular - Changing the default angular delimiter.

I just spent a wasted hour trying to figure out why an angular app written by one of my employers contracts was behaving so strangely. Apparently in angular you can override the default {{}} delimiter like so:

var myApp = angular.module('myApp', [], function($interpolateProvider) {
You would now define a template{{ var }} as [[ var ]]

Check the documentation on the $interpolate service here:$interpolate
I really can't think of a reason why you would want to do this offhand - unless you are trying to be a troll Javascript hipster!

Great trap for young players.

No comments:

Post a Comment