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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.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
Google chrome extension ng href在Chrome扩展中填充链接列表时_Google Chrome Extension_Angularjs - Fatal编程技术网

Google chrome extension ng href在Chrome扩展中填充链接列表时

Google chrome extension ng href在Chrome扩展中填充链接列表时,google-chrome-extension,angularjs,Google Chrome Extension,Angularjs,我正在开发一个带有Angular的Chrome扩展,我正在尝试使用ng repeat创建链接列表。除了在填充链接“href属性时遇到问题外,效果非常好: <ul> <li ng-repeat="item in menu" class="ng-scope"> <a ng-href="#/new" href="unsafe:chrome-extension://ehklbggiaofbhgcghgnmejkpgommihdl/popup.html

我正在开发一个带有Angular的Chrome扩展,我正在尝试使用
ng repeat
创建链接列表。除了在填充链接“
href
属性时遇到问题外,效果非常好:

<ul>
    <li ng-repeat="item in menu" class="ng-scope">
        <a ng-href="#/new" href="unsafe:chrome-extension://ehklbggiaofbhgcghgnmejkpgommihdl/popup.html#/new">Add Link</a>
    </li>
    <li ng-repeat="item in menu" class="ng-scope">
        <a ng-href="#/bookmarks" href="unsafe:chrome-extension://ehklbggiaofbhgcghgnmejkpgommihdl/popup.html#/bookmarks">My Bookmarks</a>
    </li>
</ul>

如何防止插入
不安全:chrome扩展名
内容?注意:我在我的应用程序根目录上设置了
ng csp

我现在也面临同样的问题。没有找到任何解决办法。 请检查此链接:

按照此操作,检查上的app.js

代码如下:


var app=angular.module('angularjs-starter',[])

app.config(函数($compileProvider){ $compileProvider.urlsanizationwhitelist(/^\s*(https?| ftp | mailto | file |chrome扩展名):/); });


这对我来说很有效。

我怀疑这与我的行为有关。在我的扩展中,当我用
创建链接时,我得到
。据我所知,AngularJS并没有试图用绝对路径预先设置相对链接。当您使用href而不是ng href时,您的标签是什么样子的。链接是否像预期的那样打开了“新建”页面?@stewie我认为问题在于
不安全:chrome-extension://...
part,而不是duplicate属性。@BrandonTilley我不知道你为什么这么理解我的评论。我完全意识到不安全…
的问题。@stewie我又读了几遍,很有道理:)很抱歉给你带来了困惑@stewie只有在使用ng repeat中的ng href时才会出现这种情况。当我在其他地方使用ng href时,一切都正常工作。我在1.2.1下遇到了一个错误-从
urlsanicationwhitelist
更改为
aHrefSanitizationWhitelist
修复了它。