- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在尝试在我的 Controller 中查看由 View 中的过滤器生成的集合时遇到问题。
我将过滤后的数据存储在一个变量中:
<table class="table">
<tr ng-repeat="item in filteredCollection = (myCollection | filter: txtSearch)">
<td ng-bind="item"></td>
</tr>
</table>
我想在我的 Controller 中订阅“filteredCollection”的更改:
$scope.$watchCollection('filteredCollection', function() {
if (typeof($scope.filteredCollection) != 'undefined')
console.log('Results changed : ' + $scope.filteredCollection.length);
});
我已经设置了this JSFiddle向您展示我的问题:我的 watch 功能从未被调用。
有趣的是,当我删除所有 <tabset> <tab>
时它会起作用我的 HTML 中的标签。我想我搞砸了 $scope,但我不明白为什么。也许 tabset 会创建一个新的 $scope child 或其他东西。
我希望你们能弄清楚这里发生了什么,
干杯
最佳答案
尝试将 filteredCollection
放入一个对象中,这样它就会更改正确的范围属性:
$scope.obj = { filteredCollection : [] };
$scope.$watchCollection('obj.filteredCollection', function(newVal) {
if (typeof($scope.obj.filteredCollection) != 'undefined')
console.log('Results changed : ' + $scope.obj.filteredCollection.length);
});
在 HTML 中:
<tr ng-repeat="item in obj.filteredCollection = (myCollection | filter: txtSearch)">
查看此 fiddle .
关于javascript - tabset 中的 AngularJS $scope 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29392919/
如果按“tab Two”,它工作得很好。但是,如果您尝试按“Tab one”返回,它不会显示 tab one 内容。 我尝试了不同的方法,但我找不到我应该在代码中修改什么以使其工作。 HTML:
我想提供一个来自另一个页面的链接 ,该链接打开我的包含这些选项卡的页面以查看其内容,直接说 tab2。我只是使用 CSS 脚本制作这些选项卡,没有 JS。我正在寻找可以像“mypage/#tab2”一
我有一个 R Shiny 应用程序,它计算不同选项卡集中的多个统计数据。由于计算非常密集,我使用 submitButton 来防止 react 。我现在的问题是每个计算(都在不同的标签集中)正在将输出
我在 AngularJS SPA 中使用 angular-ui-router 以及 bootstrap tabset 指令。 这是我的例子http://plnkr.co/V0Cs6BfnggXshaw
最近我开始使用 Angular 和 ng-bootstrap 进行开发。我正在 Reactive Forms 的帮助下处理一个表单,它包含一些 FormControls 和一个嵌套的 FormArra
我正在使用 Angular 5.2.10(也在 5.0.2 中测试)+ Bootstrap 4.1.1(也在 4.0.0 中测试)+ ng-bootstrap 1.1.2 并尝试制作 tab-set
有一个 uib-tabset 和一个等待 uib-tabset 内输入更改的指令,已到达该指令,但当它必须触发作用域时。$broadcast 不会调用该函数。 查看
长话短说,我正在尝试使用 knitr 来动态创建单独的标签集并在每个标签集内渲染一个图。下面是我失败尝试的描述。我希望有一个解决方案,但我怀疑我只是不了解 knitr 呈现输出的基本方式。因此,如果您
我有模式框,在模式框中我有选项卡。在第一个选项卡上,我需要选择项目,并在单击“下一步”按钮时将其分配给用户。如果成功,将自动更改下一个选项卡,其中该选项卡的配置。如果服务器响应错误,请留在同一选项卡上
当我选择一个选项卡时,我希望更改 URL。我应该为每个选项卡创建一个状态吗? 这是我的代码,无需更改状态即可正常工作。 我的app.js var myApp=angular.module('app',
目前在我的项目中,我有一个 angular2 选项卡集,它显示其他 html 模板,如下所示 - 标签.html 标签.ts import {PageOneComponent} fro
我正在尝试阅读 表格 从我的 Controller 。但我收到未定义的错误。这是我的示例代码。 HTML - Controller - $scope.formId.$setPrist
首先:我完全不熟悉 bootstrap。我想使用 vertical tabset将内容显示在选项卡的右侧。我的想法草图: Vertical content 1 Vertical content 2
我在我的 Angular 应用程序中使用 ui-tab。我有 2 个选项卡(tab1 和 tab2),当 tab2 中有按钮时,我想以编程方式将 tab1 设置为事件选项卡。 这是我的 html 代码
我一直在尝试使用 uib-tabset 动态创建选项卡,每个选项卡都应该包含不同的形式,但在我的情况下,第一种形式的文本框被生成的新选项卡覆盖(如果我以一种形式输入数据,它会被复制到其他形式形式)。我
{ "name": "ModalWindow", "version": "1.0.0", "repository": { "type": "git", "url": ""
我正在使用 Shiny 的包来创建一个应用程序。我想在我的 sidebarPanel 中包含一个 tabset 面板,就像 tabsetPanel() 在用户界面中为 mainPanel() 做的那样
我在尝试在我的 Controller 中查看由 View 中的过滤器生成的集合时遇到问题。 我将过滤后的数据存储在一个变量中: 我想在我的 Cont
我很好奇是否有人知道在 Rmarkdown 中如何默认不选择标签并显示其内容?我实际上已经非常接近了,所以例如使用下面的代码,由于没有内容的“虚拟”选项卡,默认情况下我没有弹出任何内容,但我希望该虚拟
我正在使用 angular 6 和 ng-bootstrap。我想改变的背景颜色 .nav-fill .nav-link.active { margin-top: -1px; bord
我是一名优秀的程序员,十分优秀!