【问题标题】:HTML Page Select All Angular issue or NWJS issue?HTML 页面选择所有 Angular 问题还是 NWJS 问题?
【发布时间】:2016-11-16 22:25:17
【问题描述】:

我有一个问题,当我在我的 HTML Angular 应用程序中导航时,当页面呈现时,页面上的所有内容都呈现为“已选择”。

我正在使用最新的 Angular 1.x 版本以及 Angular 材料(最新)。我应该补充一点,我在 NWJS 0.12 中运行它,这可能是一个因素

我尚未确定导致这种情况发生的确切行为模式,但它通常足以让用户感到厌烦。

【问题讨论】:

  • 你能显示一些标记/代码吗?

标签: angularjs html angular-material nwjs


【解决方案1】:

let selector = document.querySelectorAll("h1");

for(let i = 0; i < selector.length; i++){

  let ng = selector[i].getAttribute("ng-model");
  
  if(ng != null){
    console.log(selector[i].classList.add("selected"))
  }
  

}
.selected{
  background: skyblue;
  display: block;
}
<h1>20% Cooler</h1>
<h1 ng-model="cooler">20% Cooler</h1>
<h1 ng-model="cuteOctocat">GitHubr</h1>

【讨论】:

    【解决方案2】:

    我将我的 nwjs 版本升级到 0.14.7,问题就消失了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-24
      • 2018-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多