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+鼠标右键会出现在此处打开命令行,打开后输入http-server成功会出现下图
- 5 回答
- 0 关注
- 3516 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消