Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/421.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
Javascript AngularJS-动态Youtube URL不能正确处理对象_Javascript_Angularjs - Fatal编程技术网

Javascript AngularJS-动态Youtube URL不能正确处理对象

Javascript AngularJS-动态Youtube URL不能正确处理对象,javascript,angularjs,Javascript,Angularjs,我是AngularJS新手,正在从RESTAPI获取数据,下面给出了示例数据 { "error": false, "videos": [ { "video_category": "ABC Category", "title": "Test Video", "video_links": [ { "id": 1,

我是AngularJS新手,正在从RESTAPI获取数据,下面给出了示例数据

{
    "error": false,
    "videos": [
        {
            "video_category": "ABC Category",
            "title": "Test Video",
            "video_links": [
                {
                    "id": 1,
                    "video_link": "https://www.youtube.com/embed/bNI4Jws68m0"
                },
                {
                    "id": 3,
                    "video_link": "https://www.youtube.com/embed/tB8tACPZ4pc"
                }
            ],
            "video_tags": [
                {
                    "id": 1,
                    "name": "ABC Tag"
                },
                {
                    "id": 3,
                    "name": "DEC Tag"
                }
            ]
        },
        {
            "video_category": "XYZ Category",
            "title": "My Test Video",
            "video_links": [
                {
                    "id": 2,
                    "video_link": "https://www.youtube.com/embed/6SS3tK1NMsE"
                }
            ],
            "video_tags": [
                {
                    "id": 2,
                    "name": "GDF Tag"
                }
            ]
        }
    ],
    "status_code": 200
}
我的AngularJS代码如下

var myApp = angular.module('myApp', []);
myApp.
controller("AppController", function($scope, $http) {

    var url = 'http://example.com/api/';

        // Get Service for Free Education Page        
        $http.get(url+'my_api_url').
        then(function(response) {
            $scope.videos = response.data.videos;
        });        

});
<section ng-repeat="video in videos">
    <h5>{{ video.video_category }}</h5>                     
    <ul>
        <li ng-repeat="links in video.video_links">
            <div class="embed-responsive embed-responsive-16by9">
            <object 
             data="{{ links.video_link }}">
            <param name="movie" value="{{ links.video_link }}">
            <param name="allowFullScreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen" value="true"></param>
            </object>
            </div>
        </li>
    </ul>
    <ul class="list-inline Tags">
    <li ng-repeat="tag in video.video_tags">{{ tag.name }}</li>
    </ul>
</section>
我的HTML代码如下

var myApp = angular.module('myApp', []);
myApp.
controller("AppController", function($scope, $http) {

    var url = 'http://example.com/api/';

        // Get Service for Free Education Page        
        $http.get(url+'my_api_url').
        then(function(response) {
            $scope.videos = response.data.videos;
        });        

});
<section ng-repeat="video in videos">
    <h5>{{ video.video_category }}</h5>                     
    <ul>
        <li ng-repeat="links in video.video_links">
            <div class="embed-responsive embed-responsive-16by9">
            <object 
             data="{{ links.video_link }}">
            <param name="movie" value="{{ links.video_link }}">
            <param name="allowFullScreen" mozallowfullscreen="mozallowfullscreen" msallowfullscreen="msallowfullscreen" oallowfullscreen="oallowfullscreen" webkitallowfullscreen="webkitallowfullscreen" value="true"></param>
            </object>
            </div>
        </li>
    </ul>
    <ul class="list-inline Tags">
    <li ng-repeat="tag in video.video_tags">{{ tag.name }}</li>
    </ul>
</section>

{{video.video_category}
  • {{{tag.name}
现在我的问题是一切正常。但是Allowfullscreen不起作用。当我点击全屏选项时,全屏不可用我正在尝试,但不幸的是无法解决此问题

如果有人能帮忙,我真的很感激


谢谢

我尝试了上述解决方案,但它对我无效。你是否将嵌入url放入了
?我已经编写了这种类型的内容---似乎是一个问题。建议您跳过它:|我尝试过上述解决方案,但它对我不起作用。您是否将嵌入url放入
?我编写了这样的类型-,似乎是一个错误。建议您越过它:|