angularjs - $state.href with absolute: true doesn't return the right url -


i'm using angular , ui router. i'm trying link shown on page user can copy , share. this thread has shown me $state.href function i'm looking for, isn't generating correct link.

an important detail here root of application not root of domain. in case, domain localhost, root of angular app in localhost/dev/app/.

here's command i'm using inside controller.

$scope.url = $state.href('survey', { survey: "asd" }, {absolute: true}); 

in app.js, following route declared:

.state('survey', {     url: "/:survey/survey?ao",     templateurl: "views/survey/survey.html",     controller: "surveycontroller",     },     data: {          requirelogin: false,         requireadmin: false     }}) 

this should return http://localhost/dev/app/#/asd/survey, instead returns http://localhost/#/asd/survey.

(the remarkable thing ui-sref="survey({survey: "asd"}) translate correct link.)

is there way can fix full url?

adding base tag app page solved issue me. defines base url page router references. legacy support reasons, i'm on version 0.2.15 of angular ui router. don't know if still necessary more current versions.

<base href="http://localhost/dev/app/" /> 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -