Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't work with custom interpolation #758

Open
tnajdek opened this issue Nov 27, 2015 · 4 comments
Open

Won't work with custom interpolation #758

tnajdek opened this issue Nov 27, 2015 · 4 comments

Comments

@tnajdek
Copy link

tnajdek commented Nov 27, 2015

Because templates are already cached with {{ }}, setting up custom interpolation in my app will produce incorrect output (e.g. a placholder saying {{getFilterPlaceholderValue...)

The following should fix it (based on similar issue):

angular.module("ngTable").service(
    "$InterpolateUpdateService", function($templateCache, $interpolate){
        'use strict';

        this.changeGridInterpolate = function() {
            var templates = [
                'ng-table/filterRow.html',
                'ng-table/filters/number.html',
                'ng-table/filters/select-multiple.html',
                'ng-table/filters/select.html',
                'ng-table/filters/text.html',
                'ng-table/groupRow.html',
                'ng-table/header.html',
                'ng-table/pager.html',
                'ng-table/sorterRow.html'
            ];

            var start = $interpolate.startSymbol();
            var end = $interpolate.endSymbol();

            for (var i = 0; i < templates.length; i++) {
                var template = templates[i];
                var curTemplate = $templateCache.get(template);
                if (start !== "}}"){
                    curTemplate = curTemplate.replace(/\{\{/g, start);
                }
                if (end !== "}}"){
                    curTemplate = curTemplate.replace(/\}\}/g, end);
                }
                $templateCache.put(template, curTemplate);
            }
        };
    });

angular.module('ngTable').run(function($InterpolateUpdateService) {
    'use strict';

    $InterpolateUpdateService.changeGridInterpolate();
});
@portokallidis
Copy link

Does this mean that now we can render html inside cells?

@gcsideal
Copy link

Do you mean
if (start !== "{{"){
?

@zwiy
Copy link

zwiy commented May 22, 2017

Are there any news for this bug/improvement?

@tuckbick
Copy link

tuckbick commented Apr 7, 2018

This is the issue I think: #1021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants