angularjs-ng-repeat

angular ng-repeat and images in a row

寵の児 提交于 2019-12-11 12:08:47
问题 In my view model I have an array of exactly 4 icon names. If I place the 4 images like so: <img ng-src="{{'/Content/img/' + vm.indicator[0]}}" alt="" /> <img ng-src="{{'/Content/img/' + vm.indicator[1]}}" alt="" /> <img ng-src="{{'/Content/img/' + vm.indicator[2]}}" alt="" /> <img ng-src="{{'/Content/img/' + vm.indicator[3]}}" alt="" /> they appear nicely in a row as desired. However, when I use <div ng-repeat="indicator in vm.indicator track by $index"> <img ng-src="{{'/Content/img/' +

Change list arrangement - HTML & CSS

落花浮王杯 提交于 2019-12-11 12:05:58
问题 I got list like below <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> </ul> How do make the list arrangement to like this. 1 2 5 6 9 10 3 4 7 8 11 ....etc or 1 3 5 7 9 11 2 4 6 8 10 .... etc I need this arrangement because i'm using angular ng-repeat , so i need every number has the same element. I dont mind if you guys give the answer using other element, but every number must have same element. Thanks p/s: the number will increase when scroll,

Using ng-repeat and ng-class in directive template causes an unknown error

余生长醉 提交于 2019-12-11 12:05:28
问题 I have a directive that turns a collection of items into a variable number of columns. The template for the directive uses ng-repeat to repeat the columns, and ng-class to apply a css class that turns the div into a column. The problem is angular throws errors when using the ng-class on same line as ng-repeat. Removing it fixes the issue, but the directive doesnt work properly. Now, this same functionality works fine in normal angular views, but not when used in a directive template. Here is

AngularJS ng-repeat - http.gs retrieving data, but not displaying

孤街浪徒 提交于 2019-12-11 11:53:50
问题 I am new to angular and trying to integrate it within my application. I am attempting to use a simple $http.get to a .JSON file, which displaying the matching contents in a ng-repeat Here my get: $scope.countries = []; $http.get('/resources/data/countries-report.json').success(function(data) { $scope.countries = data.countries; // alert(JSON.stringify($scope.countries)); console.log(data.countries); console.log(data.countries.population); }).error(function(error) { alert('error'); }); Here's

when a radio button is in ng-repeat when i click on radio button the div will be enable?

旧时模样 提交于 2019-12-11 11:10:53
问题 Here when i click on radio button the following div should be disable if the checked radio button is equals to sj.But here its not working if i use ng-repeat for radio button same is working if its static.Could any one help me out what is the mistake i have done here? <div ng-app="plunker"> <div class="wrap" ng-controller="MyCtrl"> <h1>Hello there!</h1> <p>Push the radio buttons to change the content!</p> <form> <div ng-repeat="s in color"> <input id="first" type="radio" name="content" ng

Model does not persist using uib-typeahead with ng-repeat

余生长醉 提交于 2019-12-11 10:48:15
问题 I am trying to use uib-typeahead to select one or more objects (via an ng-repeat ), but facing an issue where the model does not persist when adding another object. This is reproduced on Plnkr here (based on ui-bootstrap's demo). (Reproduce the error by selecting a state, then clicking "Select another". The previously selected state disappears!) What is causing the model to not persist? How can this be fixed? Is it an issue with uib-typeahead ? Or the ng-repeat scope? NB: I am also using a

Bootstrap multiselect is not working when i bind the data from response in Angularjs

只愿长相守 提交于 2019-12-11 10:32:52
问题 Bootstrap multiselect is not working when i bind the data from response in Angularjs angular.module('ngvalueSelect', []) .controller('ExampleController', ['$scope','$http', function($scope,$http) { $http.get('https://reqres.in/api/unknown') .then(function (result) { console.log(result.data); $scope.exampleData = result.data; $scope.data = result.data; }) $scope.data = { availableOptions: [ {value: '001', name: 'Hello'}, {value: '002', name: 'integer'}, ] }; console.log( $scope.data ); }]);

AngularJS ng-options inside custom directive which is inside ng-repeat

自作多情 提交于 2019-12-11 10:25:40
问题 Could you help me to find a way to set and get select element values which are placed inside my custom directive. This is what I have: <body ng-app="myApp"> <div ng-controller="MyCtrl"> <div ng-repeat="category in categories"> {{category.Name}}: <status-selector items="statuses" ng-model="selectedStates[status.Id]"></status-selector> </div> </div> </body> I have two arrays: categories and statuses. Each category can have its own status. When a status for a category is chosen, it should be

Determining how many results are shown by ng-repeat filter

为君一笑 提交于 2019-12-11 10:14:55
问题 If I use ng-repeat with filter , how can I determine how many elements are filtered out (or vice versa, how many are shown)? Specifically, I would like to create a search bar that creates the filter, but I would also like to show how many elements are hidden by the filter (ie something like Showing 6 of 10 results ). 回答1: Please see here http://jsbin.com/xuyuy/1/edit In your repeater you can create new array ie : personsfiltered ng-repeat="person in personsfilterd = (persons | filter : search

To display results of 2 ng-repeats alternately

坚强是说给别人听的谎言 提交于 2019-12-11 10:05:49
问题 I need the values returned from {{compNames}} and {{compDesc}} to print alternately, like a top-down stack. But with the 2 ng-repeats I'm not able to get it in that format. <div class="title"> <table> <tr> <td class="comp-names" ng-repeat="compNames in $ctrl.data.compNames track by $index">{{compNames}}</td> </tr> <tr> <td class="comp-desc" ng-repeat="compDesc in $ctrl.data.compDesc track by $index">{{compDesc}}</td> </tr> </table> </div> If I print out {{$ctrl.data}}, I get the following- {