问题描述
- 一个AngularJS和ui-bootstrap的问题...
- 这是 http://angular-ui.github.io/bootstrap/ 页面中的一个示例程序,可是运行不了..看了半天也是不知道哪里出了问题。错出在哪里了?
代码如下<!DOCTYPE html><html ng-app=""myApp"" lang=""en""><head> <meta charset=""UTF-8""> <title>AngularJS carousel</title> <script src=""angular.min.js""></script> <script src=""ui-bootstrap.min.js""></script> <script src=""ui-bootstrap-tpls.min.js""></script> <link rel=""stylesheet"" href=""carousel.css""></head><body><div ng-controller=""CarouselDemoCtrl""> <div style=""height: 305px""> <carousel interval=""myInterval"" no-wrap=""noWrapSlides""> <slide ng-repeat=""slide in slides"" active=""slide.active""> <img ng-src=""{{slide.image}}"" style=""margin:auto;""> <div class=""carousel-caption""> <h4>Slide {{$index}}</h4> <p>{{slide.text}}</p> </div> </slide> </carousel> </div></div><script>angular.module('myApp'['ui-bootstrap']).controller('CarouselDemoCtrl' function ($scope) { $scope.myInterval = 5000; $scope.noWrapSlides = false; var slides = $scope.slides = []; $scope.addSlide = function() { var newWidth = 600 + slides.length + 1; slides.push({ image: '//placekitten.com/' + newWidth + '/300' text: ['More''Extra''Lots of''Surplus'][slides.length % 4] + ' ' + ['Cats' 'Kittys' 'Felines' 'Cutes'][slides.length % 4] }); }; for (var i=0; i<4; i++) { $scope.addSlide(); }});</script></body></html>
时间: 2024-11-29 11:55:05