ionic ng-bind-html
来源:互联网 发布:淘宝原产地政府背书 编辑:程序博客网 时间:2024/05/23 11:50
1、ionic ng-bind-html 指令
ng-bind-html 指令是通一个安全的方式将内容绑定到 HTML 元素上。
2、html
<element ng-bind-html="model.htmlStr"></element><element ng-bind-html="formatProperty(item.VendorInfo.Property)"></element><span class="item-note text-orange" ng-bind="formatPaymentType(model.deliveryDetail.PaymentTypeId)"></span><span class="badge badge-assertive"><i class="icon ion-flash"></i> {{formatOrderState(model.deliveryDetail.OrderState)}}</span>
3、controller
app.controller('MessageCtrl', function ($scope, $sce) { $scope.model = { "htmlStr": $sce.trustAsHtml('<i class="icon ion-tips">hello</i>') }; $scope.displayProperty = function (property) { switch (property) { case 1: return $sce.trustAsHtml('<i class="icon ion-tips">hello</i>'); case 2: return $sce.trustAsHtml('<i class="icon ion-tips">world</i>'); case 3: return $sce.trustAsHtml('<i class="icon ion-tips">hello</i> <i class="icon ion-tips">world</i>'); default: return $sce.trustAsHtml('<i class="icon ion-tips">hello</i>'); } } $scope.formatPaymentType = function (type) { switch (type) { case 1: return "货到付款"; case 2: return "在线支付"; case 3: return "在线支付"; case 4: return "在线支付"; case 5: return "代金券"; default: return "在线支付123"; } } $scope.formatOrderState = function (type) { switch (type) { case 0: return "等待商户响应"; case 1: return "交易已完成"; case 2: return "商户已接单"; case 3: return "商户已接单"; default: return "555666"; } }});
0 0
- ionic ng-bind-html
- ionic ng-bind-html
- ionic ng-bind-html
- ng-bind-html指令
- ng-bind-html指令
- ng-bind ng-bind-html ng-bind-template 区别
- 关于ng-bind-html 指令
- ng-bind-html 的使用
- ng-bind-html的作用
- ionic 利用ng-bind-htm中且后台返回html代码中图片宽高固定解决办法
- 通过ng-bind-html添加html元素
- 使用ng-bind-html标签 注意事项
- Angular指令之ng-bind-html
- angularjs中ng-bind-html使用问题
- AngularJs ng-bind-html指令整理
- ng-bind-html和.$compile的使用
- ng-bind
- ng-bind
- JVM深入浅出(一) -- 了解Java虚拟机
- 喝完鸡汤压压惊
- 用GitHub和Hexo搭建自己的博客
- 优化 | 提高InnoDB表BLOB列的存储效率
- SharedPrefences
- ionic ng-bind-html
- c语言实现 在一个字符串中找到由同一个字符组成的最长子串
- pat甲级A1051 Pop Sequence
- centos7和linux防火墙配置入门
- 选拔赛之 kmp
- 剑指offer-链表中环的入口节点-php
- 现代前端技术解析(4)
- [李景山php]每天laravel[035]-laravel 基础知识 --- Eloquent 模型之关系映射
- 科锐课堂笔记:2017/4/10 构造函数与析构函数