angularjs - ui-sref redirect to a url with a different port -
i have following code in template:
<a class="menu-button" id="addbtn" ui-sref="board" /> and home.js entry board state following:
.state('board', { url: 'http://' + $location.host() + ':11002/gotoboard' }) however, redirect not done properly, because port part not considered @ all. tried giving entire path, failed too.
any thoughts?
it doesn't make sense redirect url different port using ui-sref, because different website. use
<a href="http://localhostorwhatever.com:11002/gotoboard"></a> to hostname dynamically use ng-href
<a ng-href="http://{{getcurrentlocation()}}:11002/gotoboard"></a> $scope.getcurrentlocation = function(){return $location.host()}; you need inject $location service controller this
Comments
Post a Comment