Folks I have real odd situation that doesn't seem to make sense to me at all. Here's my setup:角度<a href> links - odd behaviour
<html ng-app="mainApp">
<head>blah</head>
<body>
<header ng-controller="headerCntrl">
<a href="#/profile">Profile</a>
</header>
<blah>
<main ng-view></main>
<footer />
</body></html>
The header has it's own controller, then I use ngRoute to define various paths, including the profile:
.when('/profile', {
templateUrl: 'views/profile.html',
controller: 'profileController'
})
For some reason, clicking in the a href link in the header does nothing. No error, no activity. It does show the correct URL when you hover over the link, and, right-clicking and opening in new tab DOES work just fine.
Why does a normal left click not work? Bearing in mind that either:
- Typing that route in directly into address bar &
- Right click - open in new window
both work, what's stopping angular from loading that view into the div?
Any help much appreciated!
こんにちはVitaliiは、hrefを絶対リンクで置き換えても動作を変更しません。 –
問題を引き起こす可能性のある落とし穴がたくさんあります。コードなしでは、あなたがどこにいるのかを言うのは難しいです。問題を見つけるためにガイドから簡単なアプリケーションを作成するようにアドバイスできます https://docs.angularjs.org/guide/$location – Vitalii