AngularJS Function to HTML

2 posts, 0 answers
  1. Danny
    Danny avatar
    1 posts
    Member since:
    Dec 2014

    Posted 11 Oct Link to this post

    I am trying to create a function that changes the awesome icon before the test based on what the text is.

    I can't get it to read the html from the return. I have attach an image of what I am trying to create.

    field: "ProductName", title: "Status", template: " {{ setStatus(dataItem.ProductName) }} #=ProductName# "

     

     $scope.setStatus = function(name) {            
                if (name === 'Chai') {
                    return "<i class='fa fa-check-circle' style='color:green; font-size: 150%'></i>";
                }
                else if (name === 'Chang') {
                    return "<i class='fa fa-times-circle' style='color:red; font-size: 150%'></i>";
                }            
            }

  2. Stefan
    Admin
    Stefan avatar
    272 posts

    Posted 13 Oct Link to this post

    Hello Danny,

    I can assume that the issue is caused by the used format of the template and the called function inside it.

    Please check more information for the columns.template of the Kendo UI Grid:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.template

    Additionally, I made a Dojo example based on provided code and it is working as expected:

    http://dojo.telerik.com/EYagA

    I hope this is helpful.

    Regards,
    Stefan
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
Back to Top