angularjs-ng-repeat

AngularJS - ngRepeat is applied double times when $compile the element's attributes

不想你离开。 提交于 2019-12-10 23:50:35
问题 I want this $scope.name = 'Angular'; $scope.list = ['foo: {{name}}', 'bar: {{name}}']; <div ng-repeat="template in list" compile="template"></div> to be <div real="foo: Angular"></div> <div real="bar: Angular"></div> So i use $compile: $compileProvider.directive('compile', function ($compile) { return function (scope, element, attrs) { scope.$watch( function (scope) { return scope.$eval(attrs.compile); }, function (value) { //element.html(value); //$compile(element.contents())(scope); element

Angular JS callback after ng-repeat is completed dynamically

巧了我就是萌 提交于 2019-12-10 23:07:57
问题 There are tons of posts showing how to have callback functions based on a directive so that when an ng-repeat function is finished you can wait and then call a function. For example here is my example. <div ng-repeat="Object in Objects" class="objectClass" on-finish-render>{{Object.Overlay}</div> Then when it is completed the following calls my function .directive('onFinishRender', function ($timeout) { return { restrict: 'A', link: function (scope, element, attr) { if (scope.$last === true)

Ng-Repeat: Filter By Uniqueness

↘锁芯ラ 提交于 2019-12-10 23:06:21
问题 Though I have ui-boostrap installed, the browser shoots me an error Error: [$injector:unpr] Unknown provider: uniqueFilterProvider <- uniqueFilter json objects { "_id" : ObjectId("55b81956fde835be46f22294"), "life" : true, "domain" : { "hidden" : true, "name" : "Eukarya" }, "kingdom" : { "hidden" : true, "name" : "Animalia" }, "phylum" : { "hidden" : true, "name" : "Chordata" }, "klass" : { "hidden" : true, "name" : "Mammalia" }, "order" : { "hidden" : true, "name" : "carnivoria" }, "family"

Angular Filters: How to pre-filter so angular filters consider only a partial of the whole data object

对着背影说爱祢 提交于 2019-12-10 21:56:51
问题 I got a large data table (which gets its data from a json api) with multiple columns and would like to implement multiple filters doing the following: an option to select which data-column should be considered (a dropdown containing the thead option) [my columnFilter] and then an input field to filter that particular data-partial [my searchFilter] I've got the searchFilter working, but I'm not sure how to connect the columnFilter and make the searchFilter only apply to the selected data

AngularJS - ngSwitch and ngClick not working in ngRepeat

耗尽温柔 提交于 2019-12-10 21:24:50
问题 I want to display the elements of a list thanks to a ngSwitch but I can't figure out how to do with a ngRepeat . I've begun by doing it without a list, just to understand how ngSwitch works and to show you what I want to do, here's a jsFiddle that will help you understand: jdFiffle 1 Then, I try to use a list with ngRepeat but, whatever I try to do, it doesn't work. Here's a second jsFiddle with, this time, the use of a list: jsFiddle 2 It seems that ngClick and ngSwitch don't work when they

Angular View Not Updating with New Data

风格不统一 提交于 2019-12-10 21:08:52
问题 I'm a bit of an Angular newbie so sorry if this is obvious. I have a backend which returns an array of objects. After I retrieve them, I move to the next page and i need to display a checkbox for each of the objects. I can successfully retrieve them, so I change the location of browser to the next page where the checkboxes should be displayed but nothing is being displayed. I tried using $scope.$apply() however it throws an error stating that a digest is already taking place but I think that

Angularjs with Internet Explorer 11, security issue

南楼画角 提交于 2019-12-10 20:03:12
问题 I'm using Angularjs for some months and it works like a charms in Chrome/Firefox/Safari but face some problems with IE11 and Edge. It seems my problem come from ng-src since images are not displayed and src attribute is never set. Here is the code: <div class="cell col-xs-12 col-sm-6 col-md-4 col-lg-3" ng-repeat="obj in DATA.objects | orderBy:objectsOrder track by $index "> <div ng-click="setCurrent($event, obj, '{{'obj_nav_' + $index}}')"> <img ng-src="{{formatURL(obj.Id, obj.img.fileName)}}

AngularJS only first element in ng-repeat animates

人盡茶涼 提交于 2019-12-10 19:42:57
问题 For some reason using the code below, ngRepeat only animates the first item and displays the rest instantly. As soon as the scope.categories item is updated the ng-repeat is triggered in the template. dataSource.getCategories() .then(function(categories) { $scope.categories = categories; }, function(message) { dataSource.setActivity(false, message); }); But if I change the code to the one below and add <a ng-click="start()">Start</a> in the page, it works. Yes, I have tried $timeout, even up

ng-form inside ng-repeat with submit button outside of ng-repeat

笑着哭i 提交于 2019-12-10 19:24:15
问题 I've this code: <div class="row" ng-repeat="input in inputs | filter:inputNumber"> <ng-form name="form1"> <div class="col-xs-3"> <div class="form-group"> <input ng-model="inputs.number[$index]" type="number" name="number$index" class="form-control" placeholder="" min="1" max="9999" required /> <small class="label label-danger" data-ng-show="submitted && form1.number$index.$error.required">required</small> <small class="label label-danger" data-ng-show="submitted && form1.number$index.$error

Angular UI Sortable not working properly

故事扮演 提交于 2019-12-10 18:36:16
问题 I am working on Angular UI for making my menus sortable, sometimes the code works and sometimes its breaks like duplicating the entries or filling the blank menus when I am re arranging items. Following is the full code - <!doctype html> <html lang="en" ng-app="myapp"> <head> <title>Angular Sortable Demo</title> <script src="http://code.jquery.com/jquery-1.7.2.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.min.js"></script> <script src="https:/