Angularjs路由不工作。

时间:2022-11-25 19:42:32

I am attempting to route my app with angular js routing however it is not working. When I click the link nothing happens. My html:

我正在尝试用角js路由来路由我的应用程序,但是它不起作用。当我点击链接时,什么也没有发生。我的html:

<!DOCTYPE html>
<html>
<script src="./music.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular-route.min.js"></script>
<script src="./app.js"></script>
<script src="./route.js"></script>

<body ng-app="myApp" ng-controller="myCtrl">
<a href="#!/keyBoad">start</a>
<ng-view>

</ng-view>
<style>
button { width : 100px; height : 100px; } 
</style></body>

My js for routing:

我的js路由:

app . config ( function ( $routeProvider ){ 
$routeProvider
. when ( '/keyBoard' , { 
templateUrl : 'keyBoard.html' }) . otherwise ({ 
redirectTo :'404.html' }); }); 

No errors are in my console and everything I've found about this issue doesn't help. What am I doing wrong?

我的控制台没有错误,关于这个问题的所有发现都没有帮助。我做错了什么?

1 个解决方案

#1


1  

<a href="#!/keyBoad">start</a>

should be

应该是

<a href="#!/keyBoard">start</a>

#1


1  

<a href="#!/keyBoad">start</a>

should be

应该是

<a href="#!/keyBoard">start</a>