angularjs-ng-repeat

Remove item from list after filtering

回眸只為那壹抹淺笑 提交于 2019-12-04 00:46:32
I have the following issue: I've create a list that allow the user to delete an item from list, as following: When user click on trash icon, the item is removed normally. The problem is when the user uses the filter on top. In that case, if I delete the number 6565 (index 4 in original list, 1 on filtered list), the item deleted is on index 1 on original list, resulting on delete the register with number #564456 This is my delete call on click: $scope.deleteOwn = function (uuid) { console.log(uuid); var coupon = $scope.ownsCoupons[uuid]; Coupon.delete({'id' : coupon.uuid}, function () { $scope

ng-repeat on two arrays

坚强是说给别人听的谎言 提交于 2019-12-04 00:39:52
问题 I want to do a ng-repeat on an array which is composed of two arrays, like this : [titles: [], links: []] My arrays (titles and links) have the same length What i want to print in my ng-repeat, finally, is anything like that : {{ array.title }} {{ array.link }} For example, in a C program i have to do that : int i; i = 0; while (titles[i]) { printf("%s - %s", titles[i], links[i]); i++; } 回答1: It's not clear how you have your data — [titles: [], links: []] isn't meaningful. Ideally you would

Angular get length of filtered ng-repeat

早过忘川 提交于 2019-12-04 00:07:33
I have upgraded to Angular 1.2.9 from v 1.0.8 to help with the performance of my app. I have introduced track by which has improved the speed. What I used to have <div class="result row" data-ng-repeat="result in (filteredItems = (results | filter: filterPrice | filter: filterCategories | filter: filterTypes | filter: filterAirConditioning | filter: filterTransmission | filter: filterFourByFour | filter: filterFuelType | filter: filterNumberOfDoors | filter: filterOnAirport | filter: filterFuelPolicy | filter: filterUnlimitedMileage | filter: filterFreeCancellation | filter:

how to set dynamically height to element?

做~自己de王妃 提交于 2019-12-04 00:03:35
I am trying to set dynamically height to element in my demo .I will tell you issue I am taking static or constant value of height in my demo .I take 250px constant value #wrapper{ background-image: url(https://dl.dropboxusercontent.com/s/nz1fzunlqzzz7uo/login_bg.png?dl=0); min-height: 250px; background-repeat: no-repeat; } But I need to add this height dynamically .I got height from this $scope.hgt =$window.innerHeight/3; alert($scope.hgt) But I need to set $scope.hgt to min-height to #wrapper div dynamically?.I don't want to take static value of div height .I want to add dynamically . here is

Error: [ngRepeat:dupes] what does this mean?

旧时模样 提交于 2019-12-03 23:33:32
repeat directive outputing wine records from an api. I have a factory function to serve up the wine API which is then accessed in my controller app.factory("Wine", function ($http){ var factory = {}; //getWines factory.getWines = function(){ return $http.get("http://www.greatwines.9000.com") } } Controller: app.controller("winesCtrl", function($scope, $http, Wine){ Wine.getWines() .success(function(wines){ $scope.wines = wines; }) .error(function(){ alert("Error!"); }); }); VIEW: <h2>Wine list</h2> <div class="row margin-top-20 wine-container" ng-repeat="wine in wines"> <div class="col-sm-3">

jQuery Swiper script to run after Ng-Repeat elements are loaded

放肆的年华 提交于 2019-12-03 23:27:58
I'm making a web app using AngularJS, jQuery, HTML, CSS and Bootstrap, and I would like to pick some image links from my JSON that is located in an Apache2 server and use them in order to render those images in my main page. I would also like to swipe them like in a carousel. To make that work, I'm trying to use iDangero.us Swiper . When I pick my images with 3 separated divs, I have no problems. I get my images and then I can normally swipe them as I want. I do it like shown below: Main.html: <div ng-init="initGetRequestMain()"> <div class="swiper-slide" ng-click="swipers()" style="{{data

AngularJS: Setting a variable in a ng-repeat generated scope

半世苍凉 提交于 2019-12-03 23:14:48
How do I access the set of scopes generated by an ng-repeat? I suppose at the heart of this is the fact that I don't understand quite how the relationship works between a) the collection of objects that I pass into the ng-repeat directive and b) the collection of scopes that it generates. I can play around with (a), which the ng-repeat scope watches and picks up, but how do I set variables on the scope itself (b)? My use case is that I have a set of elements repeating using ng-repeat, each of which has an edit view that gets toggled using ng-show/ng-hide; the state for each element is held in

how make ng-model=“search” have influence on leaflet directive?

ぐ巨炮叔叔 提交于 2019-12-03 22:39:10
问题 I use leaflet-angular-directive, i successfully display objects in table and map, although i achieved filtering through searching input only affect geojson objects in table. My aim: make filtering through searching input affect geojson objects in table and map. My Module var AppMapDirectory = angular.module('DirectoryAppMap', ['ngResource', 'leaflet- directive']); My Factory AppMapDirectory.factory("Directory", function($resource) { return $resource("json/result.json", {}, { get: { method:

Angular HTML Select option disable and enable

纵饮孤独 提交于 2019-12-03 22:33:48
I have a html select option <select> <option ng-repeat="field in filter.fields" value="{{field.id}}">{{field.name}}</option> </select> which I am iterating from ng-repeat , I want to disable option on basis of a filed selectable like <select> <option ng-repeat="field in filter.fields" {field.selectable==true?enable:disable} value="{{field.id}}">{{field.name}}</option> </select> How can I achieve this with angular? Assuming you have a structure like this: $scope.filter = { fields: [ {id: 1, name: "a", selectable: false}, {id: 2, name: "asdf", selectable: true}, {id: 3, name: "qwet", selectable:

AngularJS : custom iterations/data transformations and grouping… when simple ng-repeat just won't cut it

∥☆過路亽.° 提交于 2019-12-03 22:11:58
Still this problem Angular.js more complex conditional loops but I felt that the answer to the question as it was asked was right so I accepted it. So let me elaborate more than I did in the original question. I'm trying to get this <h3>11.4.2013</h3> <ul> <li>oofrab | 4 | 11.4.2013 14:55 <button>remove</button></li> <li>raboof | 3 | 11.4.2013 13:35 <button>remove</button></li> </ul> <h3>10.4.2013</h3> <ul> <li>barfoo | 2 | 10.4.2013 18:10 <button>remove</button></li> <li>foobar | 1 | 10.4.2013 12:55 <button>remove</button></li> </ul> from this data structure [ { "id": 4, "name": "oofrab",