链接<a> does not navigate to desired route</a>

时间:2014-12-15 15:39:53

标签: angularjs bootstrap-modal

我有一个下面给出的bootstrap模式,它位于一个角度控制器registrationCtrl内,如果尝试重新注册,它会弹出。模态的页脚有一个LOGIN链接,但是当我点击链接时,只有浏览器地址栏中的网址会发生变化。但该页面并未按原样导航到/login

<div class="modals">
    <div id="registered" tabindex="-1" role="dialog" aria-labelledby="registeredModal" aria-hidden="true" class="modal fade">
        <div class="modal_container">
          <div id="modal-head"><span>Already Registered</span></div>
          <div class="modal_body">
              ...
          </div>
          <div class="modal_footer">
            <div id="notice"><span>*Please login to continue or cancel to register with different </span></div>
            <div class="buttons button-toolbar">
              <div class="login btn-vert-block">
                  <span><a href="/login">LOGIN</a></span>
              <div class="cancel btn-vert-block">  <!--the link that is not working-->
                  <span>
                     <button type="button" data-dismiss="modal">CANCEL</button>
                  </span>
              </div>
            </div>
          </div>
      </div>

当用作独立的html时,模态非常有效。我在这里缺少什么?

1 个答案:

答案 0 :(得分:0)

链接问题出现在整个html页面中,并不是模态所独有的。我发现问题源于将html5Mode设置为true

angular.module("MyAPP",[],function($locationProvider){
    $locationProvider.html5Mode(true);
});

如果我们将target='_self'放在锚标记中,则链接会导航。我从here找到了解决方案。但我找不到实际的理由和解释。如果有人可以给我一些很有帮助的解释,因为我是一个有角度的初学者。

相关问题