Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 正在使用正在手动更改的属性更新作用域_Angularjs - Fatal编程技术网

Angularjs 正在使用正在手动更改的属性更新作用域

Angularjs 正在使用正在手动更改的属性更新作用域,angularjs,Angularjs,关于这个问题我已经思考了好几个小时了,但一直没能想出一个优雅的方法。 我正在实现一个简单的视频播放器,让用户修剪视频的含义,选择开始和结束时间。我从服务器上获取了一组动态视频,如下所示: $scope.videos = [{ id: "1", start: 122, end: 187, length: 352, url: "https://www.youtube.com/watch?v=-ePGMfDkTH

关于这个问题我已经思考了好几个小时了,但一直没能想出一个优雅的方法。 我正在实现一个简单的视频播放器,让用户修剪视频的含义,选择开始和结束时间。我从服务器上获取了一组动态视频,如下所示:

$scope.videos = 
    [{
        id: "1",
        start: 122,
        end: 187,
        length: 352,
        url: "https://www.youtube.com/watch?v=-ePGMfDkTHo"
    },
    {
        id: "2",
        start: 122,
        end: 187,
        length: 352,
        url: "https://www.youtube.com/watch?v=dVlM2LW90nU"
    }... etc];
使用ng repeat,我可以在客户端上显示视频

以下是我对每个包含视频的iframe的看法:

<iframe class="video" length="{{asset.length}}" start="{{asset.start}}" end="{{asset.end}}" original-url="{{ asset.url }}" data-value-start="asset.start"></iframe>
我的问题是,一旦用户更改了时间,我需要将新的开始和结束时间发送回服务器。我原以为更改“start”和“end”属性会更改video scope变量中的相同属性,但这不会发生。我在想一些不带角度的方法来解决这个问题,比如在“vidId”视图中添加另一个自定义属性,并让它作为我跟踪新的开始和结束时间的指南,但这样做似乎是错误的

我错过了什么

谢谢,,
Mila

您可能需要手动运行摘要循环。我使用了$scope。$apply,不幸的是$scope没有帮助。$applyfunction{$caller.attr'src',$scope.trustsrcreateEmbeddeUrlURL,$scope.newAssetData.start,$scope.newAssetData.end;$caller.attr'start',$scope.newAssetData.start;};如果您在指令内部使用它,请尝试$scope。$evalAsyncfunction{//you code here};或者,如果它在控制器内部,我更喜欢使用$timeout,那么代码将是$timeoutfunction{//这里的代码}您能为我们提供完整的代码片段吗?控制器、其模板和iframe的指令?
$scope.$apply(function()
   {
      $caller.attr('src',$scope.trustSrc(createEmbedUrl(url, $scope.newAssetData.start, $scope.newAssetData.end)));
      $caller.attr('start', $scope.newAssetData.start);
   });