ng-repeat

ng-switch and ng-repeat on the same element interfearing

余生长醉 提交于 2019-12-08 15:36:29
问题 I encountered behaviour in Angular I did not expect and the purpose of this post is to find out whether this is a bug or intended and possibly an explanation why it is intended. First see this Plunkr: http://plnkr.co/edit/CB7k9r?p=preview . In the example I created an array called array with three object entries. Further I created a ng-switch based on the content of an input field (called toggle). When the value of toggle is 1 it should print all names of the objects in the array prefixed

Memory leak in Ionic(or angular)?

China☆狼群 提交于 2019-12-08 07:54:54
问题 I'm new to both Ionic and Angular, so I'm not sure where the problem would actually lie between the two(if either). I seem to have a problem with ng-repeat not clearing memory. I've written a bare bones example to demonstrate http://codepen.io/pen/pvQyxj index.html <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <link href="//code.ionicframework.com/nightly/css/ionic.css" rel=

ng-repeat filter to iterate only over elements with certain property value

非 Y 不嫁゛ 提交于 2019-12-08 07:37:25
问题 I want to ng-repeat through an array, but filter the results so that only the elements that match a certain property value will be displayed. Is this possible, and how? Here's an example of what I'm trying to do (and obviously failing): HTML (View) <ul> <li ng-repeat="person in people | filter: person.gender == 'male'"></li> </ul> <ul> <li ng-repeat="person in people | filter: person.gender == 'female'"></li> </ul> JS (Controller) $scope.people = [ {name: "John", gender: "male"}, {name: "Sue"

AngularJS nested ng-repeat onclick

喜夏-厌秋 提交于 2019-12-08 05:58:09
问题 I need to create I dynamic ng-repeat, after populate it I want to add a click function on each repeat item and then on click I want to add another repeat inside the clicked element. This for create a little filme manager, so on folder click I want to add a list of file( <li class="item_grid" ng-repeat="(id,f) in files | filter:query" id="{{f.id}}" file-directive-right> <div class="title" ng-click="clicked(id)">{{f.id}} - {{f.titolo}}</div> </li> this is my code the problem is add a repeat

Angular ng-bind-html inside a nested ng-repeat

狂风中的少年 提交于 2019-12-08 05:57:15
问题 So I have an ng-repeat within an ng-repeat. The inner ng-repeat references "item in recipe.ingredients". The problem is that each of these "items" have special characters which don't render unless I use ng-bind-html. But when I attempt to use ng-bind-html it doesn't work. Here is the html: This works but doesn't display the special characters correctly (fractions for ingredients measurements): <div class="row" ng-repeat="recipe in recipes"> <h1 class='title'> {{ recipe.title }} </h1> <div

Save all the values in input text box that is in ng-repeat

若如初见. 提交于 2019-12-08 05:38:11
问题 I'm figuring out how can I save the values that are entered in the input text box inside ng-repeat on a single click of a button.I have seen examples like this getting values from text box that lets user to save each text box individually. Below is a sample code: $scope.items=[1,2,3,4] <div ng-repeat="item in items"> <input type="text" ng-model=item.id> </div> <button type="button" ng-click="saveAllValues()">Save</button> 回答1: You just bind the ng-model to another object and use $index to

Selecting and accessing items in ng-repeat

僤鯓⒐⒋嵵緔 提交于 2019-12-08 04:30:02
问题 I have an array of objects in a service that I want to display in a view like this <li ng-repeat="item in filteredItems = (resource.items | filter:multipleFilters..."> <span class="title">{{item.escaped_name}}</span> </li> I want these objects to be selectable which is the easy part. Then I'd need to get the count of the selected items and be able to iterate over all of them to process/change data. What is the best method to save and access the selected items? Note that the selected items

Memory leak in Ionic(or angular)?

前提是你 提交于 2019-12-08 03:54:39
I'm new to both Ionic and Angular, so I'm not sure where the problem would actually lie between the two(if either). I seem to have a problem with ng-repeat not clearing memory. I've written a bare bones example to demonstrate http://codepen.io/pen/pvQyxj index.html <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title></title> <link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet"> <!-- ionic/angularjs js --> <script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"><

Add classes to adjacent elements dynamically on mouseenter

女生的网名这么多〃 提交于 2019-12-08 03:39:41
问题 I'm creating a grid of elements and have a hover effect in place, using CSS transitions, for each element. I'd like to add secondary effects on adjacent x- and y-axis elements as well, creating a cloud effect. I imagine I'll be referencing those elements using jQuery's next() and prev() methods, or by $index and $parent.$index. The grid area will be large enough to prevent row-wrapping (using negative margins and hidden overflow). Here's a simplified example of my repeat: <div class="activity

Angular JS binding scope data within ng-repeat to form

六眼飞鱼酱① 提交于 2019-12-08 03:18:52
问题 I have a collection of items in $scope.data with fields "id","name" & "age", that are being displayed in the view using ng-repeat directive. For each set of items, there is a corresponding "edit button". I want to be able to access values for the particular set of items for which edit button was pressed. Html: <div ng-controller="Ctrl"> <div ng-repeat="i in data"> Name: {{i.name}} Age: {{i.age}} <form ng-submit="submit()"> <input type="text" ng-model="i.id"/> <input type="submit" value="Edit"