AngularJS 使用 angularjs 的时候,在 iframe 里面无法正确显示 src 指定的内容,
在做页面的时候,会在页面上显示别的网站的内容、图片或者视频一类的,我想使用iframe来简单的实现这个功能, 不过在使用以下代码:
HTML代码:
<div ng-show="paragraph.show">
<span ng-click="addModify(paragraph)" class="glyphicon glyphicon-plus"></span>
</div>
<div ng-show="!paragraph.show">
<div class="input-group">
<div class="input-group-addon">
<span class="glyphicon glyphicon-globe" ng-click="addModify(paragraph)"></span>
</div>
<input ng-model="paragraph.modifyURL" type="text" class="form-control" placeholder="Please input the URL.">
</div>
<div class="">
<p>{{paragraph.modifyURL}}</p>
<iframe width="100%" height="100%" seamless frameborder="0" ng-src="{{trustSrc(paragraph.modifyURL)}}" ></iframe>
</div>
</div>
JS代码
$scope.trustSrc = (url) ->
$sce.trustAsResourceUrl(url)
$scope.addModify = (paragraph) ->
paragraph.show = !paragraph.show
结果当我在input里面输入www.baidu.com的时候, 报错: No route matches [GET] "/show/www.baidu.com"
这个有人知道是为什么,,,