Javascript Bootstrap.js在使用Angular重新加载图像src时无法识别offsetWidth
我刚开始学习Angular,所以对我来说一切都有点新鲜 现在发生的事情是,当我在我的图库导航上切换类别时,我的HTML会发生变化。但是,一旦HTML被更改,我就会从引导程序中得到以下错误: 我怀疑这是因为在重新绑定新数据的瞬间,引导构建旋转木马没有宽度,因此出现了错误。不幸的是,我没有任何想法来解决这个问题Javascript Bootstrap.js在使用Angular重新加载图像src时无法识别offsetWidth,javascript,jquery,html,angularjs,twitter-bootstrap,Javascript,Jquery,Html,Angularjs,Twitter Bootstrap,我刚开始学习Angular,所以对我来说一切都有点新鲜 现在发生的事情是,当我在我的图库导航上切换类别时,我的HTML会发生变化。但是,一旦HTML被更改,我就会从引导程序中得到以下错误: 我怀疑这是因为在重新绑定新数据的瞬间,引导构建旋转木马没有宽度,因此出现了错误。不幸的是,我没有任何想法来解决这个问题 目前,我的代码就是这样设置的,如有任何帮助,将不胜感激!: index.html <div class="container page" ng-controller="Galle
目前,我的代码就是这样设置的,如有任何帮助,将不胜感激!: index.html
<div class="container page" ng-controller="GalleryNavigation as nav">
<!--Gallery Navigation: changes what image sources to load on click-->
<div id="gallery-nav">
<ul class="col-md-1">
<li ng-class="{active:nav.isSelected(1)}">
<a href ng-click="nav.selectSection(1)">01. print</a>
</li>
<li ng-class="{active:nav.isSelected(2)}">
<a href ng-click="nav.selectSection(2)">02. web</a>
</li>
<li ng-class="{active:nav.isSelected(3)}">
<a href ng-click="nav.selectSection(3)">03. video</a>
</li>
</ul>
</div>
<!-- Wrapper for slides -->
<div class="gallery-wrapper">
<!--All artwork loaded when clicked; refer to app.js for work directive-->
<work></work>
</div>
</div>
</div>
看看这个问题。@Goldenowner就是这样,非常感谢!
<div class="carousel-inner" role="listbox">
<!--filter by library type selected in the gallery navigation bar-->
<div class="item real" ng-repeat="slide in nav.slides | filter:nav.currLibrary">
<img ng-src="{{slide.image}}" alt="..." class="image">
<div class="carousel-caption">
{{slide.title}}
</div>
</div>
</div>
//Controller for Gallery Navigation
app.controller('GalleryNavigation',function(){
this.section="1";
this.slides=Library;
this.currLibrary="print";
this.selectSection=function(setSec){
this.section=setSec;
if(setSec==1){
this.currLibrary="print";
}
if(setSec==2){
this.currLibrary="web";
}
console.log(this.slides);
};
this.isSelected=function(checkSec){
return this.section==checkSec;
};});