Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/458.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 如何在scope变量的textAngular编辑器中剥离占位符img?_Javascript_Angularjs - Fatal编程技术网

Javascript 如何在scope变量的textAngular编辑器中剥离占位符img?

Javascript 如何在scope变量的textAngular编辑器中剥离占位符img?,javascript,angularjs,Javascript,Angularjs,我正在Angular应用程序中使用TextAngular指令。当我通过工具栏按钮插入youTube链接时,它会在编辑器中显示一个占位符图像。我希望将所有html保存在$scope变量中,但不包含占位符html。当前,如果我输出绑定到编辑器ng模型的$scope变量,我会得到如下结果: "<p><img class="ta-insert-video" ta-insert-video="http://www.youtube.com/embed/cUeMF18zA4Y" src=""

我正在Angular应用程序中使用TextAngular指令。当我通过工具栏按钮插入youTube链接时,它会在编辑器中显示一个占位符图像。我希望将所有html保存在$scope变量中,但不包含占位符html。当前,如果我输出绑定到编辑器ng模型的$scope变量,我会得到如下结果:

"<p><img class="ta-insert-video" ta-insert-video="http://www.youtube.com/embed/cUeMF18zA4Y" src="" allowfullscreen="true" width="300" frameborder="0" height="250"/></p>"
我真正想要的是:

"<p><iframe src="http://www.youtube.com/embed/cUeMF18zA4Y" allowfullscreen="true" width="300" frameborder="0" height="250"></iframe></p>"
两种解决方案

如果您只是在屏幕上输出,请使用ta bind ng model=html而不是ng bind html=html。调用将其转换为iframe语法的自定义渲染器

如果要将其发送回服务器,但不希望将其存储为占位符,请将“taapplycustomrenders”注入控制器并按如下方式使用:htmlToServer=taapplycustomrenders$scope.htmlValue