简体   繁体   中英

How to display emoji using angularJs?

I am new to angularjs and I am using "emoji-min.js" and "emoji-min.css" to display the emoji in text field.

But I am not able to display. Here is my code:

<!doctype>
<html ng-app = "app">
    <head>
        <meta charset="utf-8">
        <link rel="stylesheet" href="emoji.min.css">
        <script src="angular.min.js"></script>
        <script src="emoji.min.js"></script>
        <script>
           var app =  angular.module("app", ["emoji"])
            app.controller("AppCtrl", function ($scope) {
                    $scope.message = "String including Emoji codes :smiley:";
                });
        </script>
    </head>
    <body ng-controller="AppCtrl">
        <textarea ng-model="message"></textarea>
        <p ng-bind-html-unsafe="message | emoji"></p>
        <pre>{{ message }}</pre>
    </body>
</html>

Please tell where I am going wrong.

For ng-bind-html to work, you need to have ngSanitize module injected in your app.

checkout this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM