0
我不明白這一點。在我本地我正在嘗試開發一個網站。在該網站鏈接正在應用程序中工作,但是當我嘗試F5或複製該鏈接並將其粘貼到瀏覽器時,我得到404頁未找到錯誤。我谷歌它,發現這與解析URL有關,但不知道如何做到這一點。這裏是我的代碼:
的Javascript
.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
$stateProvider
.state('baba', {
url: "/",
templateUrl: "baba.html"
})
.state('icerik', {
url: "/icerik/:ad",
templateUrl: "icerik.html",
controller: "mmgCtrl",
})
.state('oku', {
url: "/oku/:serix/:klasor",
templateUrl: "oku.html",
controller: "nbgCtrl"
})
$locationProvider.html5Mode(true);
$urlRouterProvider.otherwise('/');
.controller('indexCtrl', function($scope, $location) {
$scope.yonlen = $location.path();
})
我有兩條路線。 /icerik
和/oku
。所以我認爲我應該這樣做,如果聲明哪個網址去哪個範圍。
的index.html
<div ng-repeat="manga in mangas">
<a ng-href="{{yonlen}}></a>
</div>
你試過了哪些網址? – Jay
您是否使用任何類型的路由模式,如ngRoute或ui.router? –
@Farzad YZ是的我正在使用'ui-router'並更新我的問題。 – Nasuh