Javascript Angular无法使用模板渲染旋转木马
我使用Angular和UI引导组件。我的目标是使用templateUrl参数为幻灯片渲染创建旋转木马,但遇到了一些问题。首先,当我运行页面时,没有显示任何内容,我也会收到以下错误:Javascript Angular无法使用模板渲染旋转木马,javascript,angularjs,carousel,angular-ui-bootstrap,Javascript,Angularjs,Carousel,Angular Ui Bootstrap,我使用Angular和UI引导组件。我的目标是使用templateUrl参数为幻灯片渲染创建旋转木马,但遇到了一些问题。首先,当我运行页面时,没有显示任何内容,我也会收到以下错误: 多个指令[carousel,slide(模块:ui.bootstrap.carousel)]要求转换: 这是我的密码: home.html <section id="slider"> <!--slider--> <div class="container"> <
- 多个指令[carousel,slide(模块:ui.bootstrap.carousel)]要求转换:
<section id="slider">
<!--slider-->
<div class="container">
<div class="row" ng-controller="homeCarouselCtrl">
<div class="col-sm-12">
<carousel interval="myInterval" no-wrap="noWrapSlides" template-url="pages/templates/offer-product-tplt.html"/>
</div>
</div>
</div>
<slide ng-repeat="slide in slides" active="slide.active">
<div class="col-sm-6">
<h1><span>E</span>-SHOPPER</h1>
<h2>{{slide.slideTitle}}</h2>
<p>{{slide.slideText}}</p>
<button type="button" class="btn btn-default get">Get it now</button>
</div>
<div class="col-sm-6">
<img src="../../images/home/girl1.jpg" class="girl img-responsive" alt="" />
<img src="../../images/home/pricing.png" class="pricing" alt="" />
</div>
</slide>
模板:提供产品tplt.html
<section id="slider">
<!--slider-->
<div class="container">
<div class="row" ng-controller="homeCarouselCtrl">
<div class="col-sm-12">
<carousel interval="myInterval" no-wrap="noWrapSlides" template-url="pages/templates/offer-product-tplt.html"/>
</div>
</div>
</div>
<slide ng-repeat="slide in slides" active="slide.active">
<div class="col-sm-6">
<h1><span>E</span>-SHOPPER</h1>
<h2>{{slide.slideTitle}}</h2>
<p>{{slide.slideText}}</p>
<button type="button" class="btn btn-default get">Get it now</button>
</div>
<div class="col-sm-6">
<img src="../../images/home/girl1.jpg" class="girl img-responsive" alt="" />
<img src="../../images/home/pricing.png" class="pricing" alt="" />
</div>
</slide>
电子购物者
{{slide.slideTitle}
{{slide.slideText}
现在就去拿
也许有人能告诉我哪里出错了?carousel的
templateUrl
属性不应该以这种方式使用。如果要将自己的HTML用于幻灯片播放控件,则只应覆盖默认的旋转木马模板。这是供参考的
您需要将
移动到
中。如果您想为幻灯片中的内容创建一个可重复使用的模板,您可以为此创建一个指令。您是否尝试过在HTML中直接使用模板而不是使用模板url?另外,您的
元素永远不会关闭。它会关闭,只是粘贴坏拷贝。我试着让这件事变得简单,一切都能成功。