angularjs-ng-repeat

How to disable an AngularJs filter when checkboxes are false (disabled)?

你离开我真会死。 提交于 2019-12-14 03:15:34
问题 I have a question about how to disable a AngularJS filter related to checkboxes. I have a classic construction: The object: $scope.wines = [ { "name": "Wine a", "type": "red", "country": "france", "style": "strong" }, { "name": "Wine a", "type": "white", "country": "italie", "style": "medium" }, { "name": "Wine a", "type": "white", "country": "france", "style": "light" }, { "name": "Wine a", "type": "rose", "country": "usa", "style": "strong" }, { "name": "Wine a", "type": "champagne",

AngularJS ng-repeat and Packery.js

风格不统一 提交于 2019-12-14 03:01:10
问题 I am trying to implement packery in an angularJS application. When I define the items manually one by one (see the commented html code), Packery works fine. When I try to do the same thing with an ng-repeat loop, packery does not work. How can I make packery work with ng-repeat in an angularJS template? The template: <div class="item-container" workspace> <div class="module-sizer"></div> <div class="gutter-sizer"></div> <div ng-repeat="item in items" class="item"> <!--my {{angular content}}

Recursive custom directives using ngRepeat

北慕城南 提交于 2019-12-14 00:19:15
问题 I'm trying to create a treeview using AngularJS. Here's my code: module.directive('treeview', function () { return { restrict: 'E', templateUrl: "/templates/ui/controls/treeview.htm", replace: true, transclude: true, scope: {}, link: function (scope, element, attrs) { console.log("treeview directive loaded"); }, controller: function ($scope, $rootScope) { $rootScope.depth = 0; $scope.items = [ { text: "face" }, { text: "palm" }, { text: "cake", childitems: [ { text: "1 face" }, { text: "1

AngularJs: grab compiled html and set into tooltip

a 夏天 提交于 2019-12-13 20:04:06
问题 I'm using angular js bootstrap tooltip to show tooltips on a set of elements. Plunker: http://plnkr.co/edit/9xk41f3CR0wnajN71bSi I need to inject into the tooltip html compiled by angular, but i don't really get how. The tooltip tutorial is not useful to me because it gets the html from the scope as variable, but for a set of elements this is not possible. How can i fill tooltip-html-unsafe ? 回答1: You can do something like this: HTML: <li ng-repeat="phone in phones"> <div phone-info index="{{

Angular Dart - execute a function right after ng-repeat has finished

不打扰是莪最后的温柔 提交于 2019-12-13 19:42:56
问题 Searching stackoverflow for this question always give me the solution for Angular.js. How would you do this in Anuglar dart? That is I want to have a function run after an ng-repeat directive in angular dart has finished rendering its elements. EDIT: It turns out that knowing when ng-repeat has finished enumerating doesn't means the appropriate dom element has being attached to the document. I guess my intended question was how to determine when all elements enumerated by ng-repeat is

How to skip $index in ng-repeat

最后都变了- 提交于 2019-12-13 19:20:33
问题 Consider the following: <div ng-repeat='quest in quests'> <div ng-switch on="quest.ui.type"> <div ng-switch-when="ms-select-single" > <div ms-select-single quest='quest' quest-num='{{(true)?numInc():return}}'></div> </div> <div ng-switch-when="ms-select-multy"> <div ms-select-multy quest='quest' quest-num='{{(true)?numInc():return}}'></div> </div> <div ng-switch-when="ms-date"> <div ms-date quest='quest' quest-num='{{(true)?numInc():return}}'>{{questNo}}</div> </div> <div ng-switch-when="ms

Calculate total of rows in ng-repeat with other controller

主宰稳场 提交于 2019-12-13 19:15:15
问题 I got rows where a total will be calculated. In my ng-repeat I have a controller RowCtrl where I calculate the total. app.controller('RowCtrl', function ($scope) { $scope.unit_price = 0; $scope.quantity = 0; $scope.$watchCollection('[row.unit_price, row.quantity]', function () { $scope.row.total = $scope.row.unit_price * $scope.row.quantity; }); }); How can I calculate the total of all the rows? In the fiddlr I have a demo of the rows where the total of a row is already calculated. Fiddlr:

How to pass ngRepeat “template” to a ngDirective using transclude?

送分小仙女□ 提交于 2019-12-13 15:29:42
问题 Demo: http://plnkr.co/edit/TiH96FCgOGnXV0suFyJA?p=preview I have a ng-directive called myDirective and within the directive template I have a list of li tags printed using ng-repeat. I want to declare the content of li tag as part of the declaration of myDirective and use transclude to print the desired text / html content. This way I can have a nice separation of concerns so that my directive doesn't need to know the structure of the source item, and it'll be the caller's responsibility to

Angularjs how to set the default value for select

孤街醉人 提交于 2019-12-13 14:24:32
问题 I have the following object: defaults = { 0 : { id : 10, value : "string 1" }, 1 : { id : 22, value : "string 2" } } I want to iterate over this object and display it as a select box. <select ng-model="selectedValue" ng-options="obj.id as obj.value for obj in defaults"> <option value="">---Select option-----</option> </select> What I'm trying to achieve is to select 'string 2' by default. But it does not work. The problem I have is the fact the selectedValue is a string: $scope.selectedValue

AngularJs ng-repeat with index

别说谁变了你拦得住时间么 提交于 2019-12-13 13:29:49
问题 I want to show the name in this section only when the display button is clicked. I'm trying to detect using index, but I didn't get success. Code : <div ng-repeat="c in customers"> <a ng-click="display(c.id[$index])" ng-hide="need to hide after click this one">{{vm.updateText}}</a> <div ng-show="c.id[$index]" class="updateSection"> <input type="text" name="id" data-ng-model="id" /> <input type="button" ng-click="vm.veryId(id)" value="{{vm.verifyButtonText}}"> <input type="button" ng-click="vm