美文网首页
angularjs中动态为audio绑定src

angularjs中动态为audio绑定src

作者: w_wx_x | 来源:发表于2019-08-09 11:26 被阅读0次

1.常见audio的使用

<audio src="/i/horse.ogg" controls="controls">
  Your browser does not support the audio element.
</audio>

2.angular.js中的绑定
       需要在对应的control中添加sce &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用sce.trustAsResourceUrl(url)处理,进行绑定即可

var feedBackCtrl = function($scope,$sce){
  $scope.sce = $sce.trustAsResourceUrl;
  $scope.audioList = [{
    contentType: "audio/mpeg",
    entityId: 179,
    entityType: 600,
    fileName: "audio.mp3",
    id: 89,
    size: 61620,
    src: "https://dev.gcb365.com/api/web/file/download?uuid=df572046-d0e5-3b23-baef-142a1486af85",
    time: 5
  }]
}
<div class="comment-audio" ng-repeat="audio in audioList track by $index">
  <audio controls="controls" ng-src="{{sce(audio.src)}}"></audio>
</div>

相关文章

  • angularjs中动态为audio绑定src

    1.常见audio的使用 2.angular.js中的绑定需要在对应的control中添加sce.trustAsR...

  • html5 audio vue

    动态修改audio的src后,如何获取时长-----先load,然后在oncanplay中获取,看getXXInf...

  • VUE动态绑定video的src不能播放

    给video绑定个ref值 在需要动态绑定的方法里用$refs动态设置src

  • angularJs ng-style实际用法

    项目里,总有需要动态绑定样式的地方。angularJs和vue动态绑定样式的制定方法大同小异。 ng-class道...

  • v-bind之动态绑定

    1. v-bind 绑定基本属性 动态绑定img的src属性 动态绑定a的href属性 等等 语法糖写法(简写):...

  • 绑定属性

    v-bind指令介绍 动态绑定属性:比如a元素的href属性,img元素的src属性 作用:动态绑定属性 缩写::...

  • vue img :src动态绑定问题

    vue img元素 :src动态绑定,本地测试没有问题,但是部署后发现动态src图片无法访问。源代码: 解决方法:...

  • vue2仿写eleme小结

    Impressions vue中的常用缩写 属性绑定:src === v-bind:src 事件绑定@click ...

  • Vue中img的src属性动态绑定

    最近在使用Vue模仿网易云音乐的App。 遇到了一个关于img的src属性动态绑定,图片不显示的问题。 我会在这里...

  • AngularJS 的变化检测

    AngularJs 1.X的变化检测 双向绑定 AngularJs中引入了双向绑定机制 首先看一下模型和DOM进行...

网友评论

      本文标题:angularjs中动态为audio绑定src

      本文链接:https://www.haomeiwen.com/subject/oapcjctx.html