angularjs 1.6.0(最新一次)線路不工作我本想在Stackoverlow上看到這個問題,但沒有。顯然,我是唯一一個有這個問題的人,在我看來,這個問題很常見。我有一個基本的項目,我正在工作,但路線似乎不工作,即使我做的一切似乎是正確的。我在我的index.html檔案:<html><head ng-app="myApp">
<title>New project</title>
<script src="https://code.angularjs.org/1.6.0/angular.min.js"></script>
<script src="https://code.angularjs.org/1.6.0/angular-route.min.js"></script>
<script src="app.js"></script></head><body>
<a href="#/add-quote">Add Quote</a>
<div ng-view ></div></body></html>這是我的app.js:var app = angular.module('myApp', ['ngRoute']);app.config(['$routeProvider', function ($routeProvider) {
$routeProvider .when('/add-quote', {
templateUrl: 'views/add_quote.html',
controller: 'QuoteCtrl'
})
.otherwise({ redirectTo: '/' });}]);現(xiàn)在,當(dāng)我訪問頁面時,下面是我在網(wǎng)址中得到的內(nèi)容:http://localhost:8000/admin#!/當(dāng)我單擊Add quote巴頓,我明白了:http://localhost:8000/admin#!/#%2Fadd-quote這里有什么問題?謝謝你的幫助
3 回答

收到一只叮咚
TA貢獻1821條經(jīng)驗 獲得超5個贊
!
href
:
<body> <a href="#!/add-quote">Add Quote</a> <div ng-view ></div></body>

慕慕森
TA貢獻1856條經(jīng)驗 獲得超17個贊
var app = angular.module("myApp", ["ngRoute"]);app.config(function($routeProvider) {$routeProvider.when("/layoutandviewbox", { templateUrl : "views/layout-and-viewbox.html"}).when("/basicshapes", { templateUrl : "views/basic-shapes.html"}).when("/advancedshapes", { templateUrl : "views/advanced-shapes.html"}).when("/groups", { templateUrl : "views/groups.html"}).when("/transformations", { templateUrl : "views/transformations.html"}).when("/effects", { templateUrl : "views/effects.html"}).when("/", { templateUrl : "views/basic-shapes.html"});});
- 3 回答
- 0 關(guān)注
- 586 瀏覽
添加回答
舉報
0/150
提交
取消