AngularJS Emoji FilterAngularJS 的过滤器

联合创作 · 2023-09-19 13:44

AngularJS Emoji Filter 是 AngularJS 的过滤器,用来替换 emoji 表情代码为实际的表情图片。

使用方法:

<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="emoji.min.css">
    <script src="angular.min.js"></script>
    <script src="emoji.min.js"></script>
</head>
<body ng-app="app" ng-controller="AppCtrl">
    <ul>
        <li ng-repeat="message in messages" ng-bind-html-unsafe="message | emoji"></li>
    </ul>
</body>
</html>

JavaScript 代码:

angular.module("app", ["emoji"]).controller("AppCtrl", function ($scope) {
    $scope.messages = [
        "Animals: 🐶 🐱 🐍",
        "People: 😄 😕 😠",
        "Places: 🏠 🏫 🏨"
    ];
});
浏览 4
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报