有只小跳蛙
angular和angular-route 版本一定要对应才能正常用吗不是要版本一样之前做了书本上的一个例子:angular版本用的1.2.16,angular-route我pull了1.5.8最新版本运行程序控制台报错:12Error: $injector:modulerrModule Error我是用bower来管理依赖文件的,哪这个工具有没有命令可以查看依赖关系呢?示例代码:12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455<!DOCTYPE html><html lang="en" ng-app="a5_6"><head> <meta charset="UTF-8"> <title>Title</title> <script type="text/javascript" src="../bower_components/angular/angular.min.js"></script> <script type="text/javascript" src="../bower_components/angular-route/angular-route.min.js"></script> <style> body{ font-size:13px; } .show{ background-color:#cccccc; padding:8px; width:260px; margin:10px 0; } </style></head><body><h1>View组件中的模版切换</h1><div> <a href="#/">首页</a>| <a href="#/book1">图书</a>| <a href="#/game">游戏</a></div><div ng-view></div></body><script type="text/javascript">var a5_6 = angular.module('a5_6',['ngRoute']); a5_6.controller('a5_6_1',['$scope', function($scope){ $scope.title = '这是首页'; }]); a5_6.controller('a5_6_2',['$scope', function($scope){ $scope.title = '这是图书页'; }]); a5_6.controller('a5_6_3',['$scope', function($scope){ $scope.title = '这是游戏页'; }]); a5_6.config(['$routeProvider', function($routeProvider){ $routeProvider.when('/',{ controller:'a5_6_1', template:"<div class='show'>{{title}}</div>" }).when('/book',{ controller:'a5_6_2', template:"<div class='show'>{{title}}</div>" }).when('/game',{ controller:'a5_6_3', template:"<div class='show'>{{title}}</div>" }).otherwise({ redirectTo:'/' }); }]);</script></html>