gullowbuild抛出引号,使用angular在HTML中添加活动类

gulp build throwing off quotes that add active class in HTML using angular

本文关键字:HTML 添加 活动 angular 使用 gullowbuild      更新时间:2023-09-26

使用吞咽角度yeoman生成器。

我写下这行是为了设置一个锚来接收一个活跃的班级。

 <a ui-sref='landing.recipe' ng-click="land.select('one')"           
   ng-class="{active: land.selected === 'one'}">Recipe</a>

显然,控制器上有一些javascript,但当我提供本地服务时,它工作得很好。

问题是,在我运行gullow构建后,它就这样做了,不再起作用,

<a ui-sref="landing.recipe" ng-click="land.select(" one")"="" 
  ng-class="{active: land.selected === " one"}"="" href="#/landing/recipe">Recipe</a>

谢谢你帮我解决这个问题。

将输入从字符串更改为实数,以消除引号中的引号,现在效果非常好。

预构建,

 <a ui-sref='landing.recipe' ng-click='land.select(1)'               
 ng-class='{active: land.selected === 1}'>Recipe</a>

构建后,

<a ui-sref="landing.recipe" ng-click="land.select(1)" 
ng-class="{active: land.selected === 1}" href="#/landing/recipe" class="active">Recipe</a>

构建后一切正常。