problem about angularjs-ng-repeat-Collection of common programming errors


  • RickCigarette
    angularjs angularjs-directive angularjs-ng-repeat
    I would like to watch for the filtering event from within my directive when filtering on ngRepeat occurs. Is there an event that gets emitted when filtering occurs?What I am doing is implementing lazy loading of images for a list of thumbnails. It works but when I start filtering, the images that were out of viewport and come into view after filtering need to get their ng-src attribute replaced.Here is the directive:TemplateBrowser.directive(‘lazySrc’, function() {return function(scope, element,

  • Deepak Nulu
    angularjs angularjs-directive angularjs-scope angularjs-ng-repeat
    I have a directive with an isolate-scope (so that I can reuse the directive in other places), and when I use this directive with an ng-repeat, it fails to work.I have read all the documentation and stackoverflow answers on this topic and understand the issues. I believe I have avoided all the usual gotchas.So I understand that my code fails because of the scope created by the ng-repeat directive. My own directive creates an isolate-scope and does a two-way data-binding to an object in the parent

  • Nitz
    javascript angularjs angularjs-ng-repeat
    I have written this code in js (developer.js) file.app.filter(‘reverse’, function() {return function(items) {return items.slice().reverse();}; });now, this code i put because i needed to reverse the ng-repeat result, so I created manual filter.But this code is working perfectly but its showing error in console.And i don’t want to see my console with all errors.Error:TypeError: Cannot call method ‘slice’ of undefinedat Object.<anonymous> (http://192.168.0.14/test/js/developer.js:35:24)at e

  • recursv
    angularjs angularjs-ng-repeat
    I’m rather new to AngularJS so I presume this is going to be something about confusing scope.I’m trying to get a ng-repeat list watching a service on the scope to update when I push a new item to the service backing model from a ng-click anchor link. An example failing fiddle is here: http://jsfiddle.net/znFwY/JS:’use strict’;angular.module(‘myApp’, []).factory(‘Order’, function () {return {packages: {theList: [],list: function () {return this.theList;},push: function (p) {if (p === undefined ||

  • aditya
    angularjs angularjs-directive angularjs-ng-repeat
    In my ng-repeat I have a directive called update which takes the current index of repeat. How can I pass index value to my directive ?This is how my markup looks like:<ul><li ng-repeat=”article in articles”><span class=”btn” update=”{{ $index }}”>update</span><span class=”btn” ng-attr-update=”{{ $index }}”>update</span></li> </ul>Directive:angular.module(‘magazine’) .directive(‘update’, function() {return {restrict: ‘A’, // restricting it only to a

  • TsenYing
    angularjs angularjs-ng-repeat
    Normally, with a form and input fields, the form controller is published into the related scope under the form name attribute. And, the NgModelController is published under the input name attribute. So for an input field with an ngModel directive, the NgModelController for the input field can be retrieved like $scope.myFormName.myInputFieldNameThe question is how to do the same thing (get the NgModelController) for input fields inside the ngRepeat directive?I would like to name the input fields

  • Cairnarvon
    angularjs-directive angularjs-ng-repeat
    I have a problem trying to get auto-headers into an ng-repeat created list. The code below creates a header based on first letter of name changing in sorted list. The code below produces the headers but when I filter on the list I get issues where I get double-ups with the header letters. Can anyone help?<li ng-repeat=”people in address | filter:query | orderBy:orderProp” alphabetical=”{{people.name[0]}}” ><alphabetical-headers-from-name stem=”people” listno=”$index” path=”path” >&l

  • PaReeOhNos
    html5 angularjs video.js angularjs-ng-repeat
    I’m trying to hook up the video.js library into my app. On one part of the app, users have the ability to upload files which may contain videos, so when output, I am using an ng-repeat to loop through the video uploads, and output an HTML5 video tag. I now want to attach a directive to the video tag so that video.js can be used with it.My video output is defined as<video ng-src=”{{video.url}}” ng-repeat=”video in post.attachments.video” type=”{{video.mimetype}}” controls preload=”metadata” id

  • acconrad
    javascript angularjs angularjs-ng-repeat angularjs-filter
    I want to achieve the following theoretical code:VIEW.html<li ng-repeat=”player in players | filter:myCustomFilter(player)”>{{player.name}}CONTROLLER.js// some theoretical conditional statement that return a boolean $scope.otherCondition = true;$scope.myCustomFilter = function(player) {return player.name.substring(0,1).match(/A/gi) && $scope.otherCondition; }So I want all of my players to be loaded into an Angular model, but I only want to render players into the DOM whose names st

  • rross
    angularjs angularjs-scope angularjs-ng-repeat
    I’m able to set the value of the query object within the view:<button ng-click=”query.Active = ‘true'” ….This updates the value bound to the filter and changes the view accordingly. Yet if I move that to the controller to be set: <button ng-click=”filterActive(‘true’)”…. $scope.filterActive = function (type) { $scope.query.Active = type; console.log(‘active’ + $scope.query.Active); };The result always returns undefined. I’m at a loss why the value is not being set.

  • Julien Rodrigues
    javascript angularjs angularjs-scope angularjs-ng-repeat
    I experience a problem which seems a kind of tricky.Here is my case: I got a list of items<table ng-controller=”ItemsCtrl”><thead><tr><th>Item</th><th>Type</th></tr></thead><tbody><tr ng-repeat=”item in items”><td>{{item.label}}</td><td><select ng-model=”item.type” ng-options=”type.value as type.label for type in typesSelect”></select></td></tr></tbody> </table>Here is my contr

  • user417918
    angularjs angularjs-ng-repeat
    I am building a table based on user defined column definitions as in this:http://jsfiddle.net/waylon999/2RvmW/1/You’ll notice I have a filter field in columns that I haven’t been able to apply. I’ve tried:{{ getItem(data, col.keyword) | col.filter }}which in chrome gives the following error: Unknown provider: col.filterFilterProvider <- col.filterFilterI’ve also tried modifying the getItem method to build out the filter string, but it just ends up rendering the | uppercase as text, appended

Originally posted 2013-12-02 01:21:34.