index.html<!doctype html> <html ng-app="bookStoreApp"> <head> <meta charset="utf-8"> <meta http-equiv="Cache-Control" content="no-transform"> <title>angular</title> <meta name="keywords" content="關鍵字1,關鍵字2"> <meta name="description" content="描述"> <script src="js/angular-1.4.6.js"></script> <script src="js/angular-route1.3.13.js"></script> <script src="js/app.js"></script> <script src="js/controller.js"></script> </head> <body> <div ng-view></div>? </body> </html> hello.html<p>{{greeting.text}},Angular</p>bookList.html<ul> <li ng-repeat="book in books">書名:{{book.title}} 作者:{{book.author}}</li></ul>app.jsvar bookStoreApp=angular.module('bookStoreApp',['ngRout','ngAnimate','bookStoreCtrls','bookStoreFilters'])bookStoreApp.config(function($routeProvider){ $routeProvider.when('/hello',{ templateUrl:'tpls/hello.html', controller:'HelloCtrl' }).when('/list',{ templateUrl:'tpls/bookList.html', controller:'BookListCtrl' }).otherwise({ redirectTo:'/hello' });});conctroller.jsvar bookStoreCtrls=angular.module('bookStoreCtrl',[]);bookStoreCtrls.controller('HelloCtrl',['$scope',function HelloCtrl($scope){ $scope.greeting={ text:'hello' }}]);bookStoreCtrl.controller('BookListCtrl',['$scope',function BookListCtrl($scope){ $scope.books=[ {title="《江湖》",anthor:"大漠窮秋"}, {title="《設計》",author:"大漠窮秋"} ]}]);運行結果是空白,為什么,求解
5 回答

Js門徒
TA貢獻1條經驗 獲得超0個贊
如果使用fireFOX是沒問題的,但是IE和chorme頁面出不來,要求啟動本地服務;
先說方法,親測有效,
首先你需要裝node,
然后在CMD窗口輸入npm install -g http-server,在打開bookStore,shift+鼠標右鍵會出現(xiàn)在此處打開命令行,打開后輸入http-server成功會出現(xiàn)下圖
添加回答
舉報
0/150
提交
取消