最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

關(guān)于Angular路由 的問(wèn)題

關(guān)于Angular路由 的問(wèn)題

最近新學(xué)習(xí)AngularJs,對(duì)于路由配置剛剛起步,遇到一個(gè)很迷的問(wèn)題。主頁(yè)面代碼如下<!DOCTYPE?html> <html?ng-app="index"> <head> <meta?charset="utf-8"?/> <title>imooc-angular</title> <script?src="js/angular-1.6.4/angular.js"></script> <script?src="js/angular-1.6.4/angular-route.js"></script> <script?src="js/angular-1.6.4/angular-animate.js"></script> <script?src="js/index.js"></script> <script?src="js/controllers.js"></script> <script?src="js/directives.js"></script> <script?src="js/filters.js"></script> <script?src="js/routes.js"></script> <script?src="js/services.js"></script> </head> <body> <a?href="#/hello">hello</a> <a?href="#/list">list</a> <div?ng-view></div> </body> </html>零件頁(yè)面代碼如下hello.html<div><span?ng-bind="hello"></span>,angular</div>list.html<ul> <li?ng-repeat="book?in?books"> 書(shū)名:{{book.title}}&nbsp;&nbsp;&nbsp;作者:{{book.author}} </li> </ul>各js代碼如下,其中filter,routes,services,directives 為只聲明了模塊的空jsindex.jsvar?index?=?angular.module("index",[ 'ngRoute','ngAnimate','indexControllers','indexServices','indexDirectives', 'indexRoutes','indexFilters' ]); index.config(function($routeProvider){ $routeProvider.when('/hello',{ templateUrl:'templates/hello.html', controller:'HelloCtrl' }).when('/list',{ templateUrl:'templates/list.html', controller:'ListCtrl' }).otherwise({ redirectTo:'/hello' }) });controllers.jsvar?controllers?=?angular.module("indexControllers",[]); controllers.controller("HelloCtrl",['$scope',function($scope){ $scope.hello?=?"hello"; }]); controllers.controller("ListCtrl",['$scope',function($scope){ $scope.books=[ {title:"book1",author:"author1"}, {title:"book2",author:"author2"}, {title:"book3",author:"author3"} ] }]);問(wèn)題一,直接訪問(wèn)index頁(yè)面,游覽器link為:http://127.0.0.1:8020/imooc-angularJs/index.html#!/hello ????????????????為什么地址是#!/hello問(wèn)題二,通過(guò)A標(biāo)簽互相跳轉(zhuǎn)時(shí)不生效,點(diǎn)擊跳轉(zhuǎn)后新link為:????????????????http://127.0.0.1:8020/imooc-angularJs/index.html#!/hello#%2Flist ????????????????或者????????????????http://127.0.0.1:8020/imooc-angularJs/index.html#!/hello#%2Fhello ????????????????為什么地址中會(huì)有亂碼問(wèn)題三,在修改A標(biāo)簽,將href="#/hello",hrel="#/list"修改成href="#!/hello",href="#!/list"后,成功跳轉(zhuǎn)????????????????為什么一定要加上這個(gè)“!”符號(hào)才能成功跳轉(zhuǎn),是什么樣的原理,希望有高手能詳細(xì)解答
查看完整描述

1 回答

  • 1 回答
  • 2 關(guān)注
  • 1969 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)