swig和angular双花括号的冲突

swig和angular都用{{name}}来作为模板中变量的取值, 那么要共用的话怎么办:

{% raw %}{{ foobar }}{% endraw %}

或者

config(['$interpolateProvider',

    function($interpolateProvider) {

        // Swig uses {{}} for variables which makes it clash with the use of {{}} in AngularJS.

        // Replaced use of {{}} with [[]] in AngularJS to make it work with Swig.

        $interpolateProvider.startSymbol('[[');

        $interpolateProvider.endSymbol(']]');

    }

])

要么告诉swig不要解析{{}}(用raw), 要么配置一下angular, 不用{{}}

来源: http://stackoverflow.com/questions/25710698/escaping-the-double-curly-braces-in-swig-templates-for-angularjs

你可能感兴趣的:(Angular)