Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.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 事件和角度js上的Peer.js_Javascript_Jquery_Angularjs_Webrtc - Fatal编程技术网

Javascript 事件和角度js上的Peer.js

Javascript 事件和角度js上的Peer.js,javascript,jquery,angularjs,webrtc,Javascript,Jquery,Angularjs,Webrtc,我对AngularJS和Peer.js都是新手。作为一个周末项目,我正在开发一个小型webrtc应用程序。为了能够做任何事情,我必须建立一个连接,我使用这个函数或者更确切地说是绑定: peer.on('open', function(id) { console.log('My peer ID is: ' + id); console.log("127.0.0.1/webRTC" + document.location.pathname + addUrlParam(document

我对AngularJS和Peer.js都是新手。作为一个周末项目,我正在开发一个小型webrtc应用程序。为了能够做任何事情,我必须建立一个连接,我使用这个函数或者更确切地说是绑定:

peer.on('open', function(id) {
    console.log('My peer ID is: ' + id);
    console.log("127.0.0.1/webRTC" + document.location.pathname + addUrlParam(document.location.search, "id", id));
});
现在我正在将创建的url发送到控制台,但我当然更愿意将其显示在有用的地方。我现在的问题是,我将如何与AngularJS合作。我来自jQuery,可以做如下工作:

$("#myElement").html(id);

但既然我想学习AngularJS,我想知道我该怎么做?

Angular是由jQuery驱动的dom操作,因为它至少嵌入了jQuery lite

来自Angular Doc

如果jQuery可用,angular.element是jQuery的别名 功能。如果jQuery不可用,angular.element将委托给 Angular的jQuery内置子集,称为“jQuery lite”或“jqLite”

如果您加载了jQuery(正如您stiller_leser在评论中所说的那样),您将能够使用

angular.element("#myElement").html(id);

如果不是,对于jqLite,使用

angular.element( document.querySelector( '#some-id' ) );

嘿,这让我走上了正轨。它的工作原理类似于so
angular.element(document.getElementById(“header”)).html(id)
。Angular告诉我它不支持按选择器查找。