1

I have used iframe in one subview with angular, and the iframe src is created automatically, which has "hash". Codes as follow~

Html:

<iframe id="user" ng-src="{{myurl}}"></iframe>

JS:

angular.module('myapp').controller('DemoCtrl', function ($scope, $sce, $cookies, $http) {
    ...
    var url = "http://example.com" + "?uk=" + $cookies.get("uk") + "#/zone";
    $scope.myurl= $sce.trustAsResourceUrl(url);
});

But hash "#zone" does not work. The iframe show content as "http://example.com?uk=XXX", not the expected url "http://example.com?uk=XXX#/zone".

However, if I click F5 to refresh browser once more, the iframe could target the correct url, with hash code.

Dose anyone know one? So thanks!

etianQQ
  • 167
  • 2
  • 9

0 Answers0