将视频源传递给angularjs中的其他元素的ng-init

时间:2015-11-06 09:36:51

标签: json angularjs hidden-field angular-services angularjs-ng-init

  

我怎样才能将视频源(srcVideo)传递给videoDetailsform.VideoUrl中的ng-init?

     

Video.html

<input ng-model="videoDetailsform.title" class="form-control input-default" ng-modal="form.vid_Title"   placeholder="Video Title." ng-init="videoDetailsform.title=''">
<video  placeholder="Drop Video Here" width="100%" ng-drop="true" ng-drop-success="objectDropped()" id="myVideo" >
   <source id="mp4Source" ng-src={{srcVideo}} type="video/mp4">
   <source id="webmSource" ng-src={{srcVideo}} type="video/Webm">    
</video>

<input type="hidden" ng-model="videoDetailsform.title" ng-init="videoDetailsform.title='{{form.vid_Title}}'">   
<input type="hidden" ng-model="videoDetailsform.VideoUrl" ng-init="videoDetailsform.VideoUrl=srcVideo"> 
  

VideoController.js

     

在此文件中,我将所有视频信息推送到 videoCs ['VideoDetails'] 并使用 myService.js 方法 createJsonFormatter()保存它。

videoCs['VideoDetails'] = [];
$scope.saveDraft = function(){
    videoCs['VideoDetails'].push($scope.videoDetailsform);
    saveData.createJsonFormatter(JSON.stringify(videoCs));
};
  

myService.js

videoCourseApp.service('saveData', function(fileSystem){
this.createJsonFormatter = function(data){

    console.log(data);
    var txtFileName = "videos.json";
    fileSystem.writeText(txtFileName, data).then(function(fs) {
        console.log('success');
    }, function(err) {
        console.log(err);
    });
};
});
  

我从输入类型获取数据但无法获取视频源。

0 个答案:

没有答案