SoftTimur SoftTimur - 6 months ago 38
AngularJS Question

Make $location.path open in the same frame (target = "_self")

In a mean-stack web application with html5mode, I have defined the following angular-ui-router

.state('addinHome', {
url: '/addin/home',
template: "home page"

Then, I have another page
with a button
<a href="/addin/home">button</a>
. Also in its controller, I have

... ...
... ...

Normally, both
and the button lead to

Now, I add the following references in

<script src=""></script>
<script src=""></script>

It disturbs the ui-router. As a consequence, both
and the button lead to
, which is NOT what I want.

I have found the solution to fix the button: it is using
<a href="addin/home" target="_self">button</a>
(opens the linked document in the same frame as it was clicked; see here).

However, I have not found the solution to fix
. Could anyone help?

Answer Source
  • Inject $window as dependency.

  • Try using $,"_self")

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download