如何查看angularjs版本
2 回答

米脂
TA貢獻1836條經驗 獲得超3個贊

有只小跳蛙
TA貢獻1824條經驗 獲得超8個贊
angular和angular-route 版本一定要對應才能正常用嗎
不是要版本一樣
之前做了書本上的一個例子:angular版本用的1.2.16,angular-route我pull了1.5.8最新版本運行程序控制臺報錯:
12 | Error: $injector:modulerr Module 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> |
- 2 回答
- 0 關注
- 4313 瀏覽
添加回答
舉報
0/150
提交
取消