Coder Social home page Coder Social logo

angular-repeat-n's People

Contributors

connorbode avatar yesmeck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

angular-repeat-n's Issues

Create New Scope element with directive instead of sub directive.

I'm using your directive for an app but because of how you used scope, I'm not able to use the index on the element with the directive.

i.e you would expect to see 50 lines, but you end up with 100 because of the scoping.

<div ng-repeat-n="100" ng-show="$index < 50">
This index will print {{$index}}
</div>

example:
http://jsfiddle.net/qejrsw4n/6/

Its really problematic if your dealing with tables, where you can't just insert spans or divs where ever you want, and where you may want to adjust colspans based on the index. I'm not likely to create a pull request with my results because I broke your code up into easier to read functions.

https://gist.github.com/mbostwick/48f197d0761a7a17bc3e4fdc9221f2a4

Files in the ./dist folder are outdated

Files in the ./dist folder are 10 months old so when I install a package using bower I get old version.
Could you please rebuild it and commit the new files?

thanks!

Error: Cannot read property 'remove' of undefined

I was getting this for awhile and tracked it down to angular-repeat-n...

In my template I do something like this...

ng-repeat-n="(whatever.accountTotalRowCount-whatever.accountRows.length)"

Where both numbers could be 0.

In the for loop at line 38 this can make the i -1 which can't be removed, so it throws:

TypeError: Cannot read property 'remove' of undefined
    at Object.fn (angular-repeat-n.js:40)
    at n.$digest (angular.js:14308)
    at n.$apply (angular.js:14571)
    at l (angular.js:9698)
    at M (angular.js:9888)
    at XMLHttpRequest.F.onload (angular.js:9829)(anonymous function) @ angular.js:11655(anonymous function) @ angular.js:8596n.$digest @ angular.js:14326n.$apply @ angular.js:14571l @ angular.js:9698M @ angular.js:9888F.onload @ angular.js:9829

My hacky fix is to just add this in the first line of the for loop:

if (i===-1) return;

So why the heck would I ever want to do ng-repeat-n="0" ?

I'm basically doing a table which lazy loads data in from a RESTful service. There's a requirement for the empty rows to be available... because requirements!

So I do something hacky like this:

<tr ng-repeat="row in accountRows">
    <td>{{ row.id }}</td>
    <td>{{ row.name }}</td>
    <td>{{ row.whatever }}</td>
</tr>
<tr ng-repeat-n="(accountTotalRowCount-accountRows.length)">
    <td colspan="3">&nbsp;</td>
</tr>

So if there are 0 remaining this will cause that error message.

npm install issues

Would be nice to get the version updated in package.json to match the version - currently it says 0.0.1 instead of 0.1.5. Then it would be nice to have this published in the NPM package registry so we can install with npm install angular-repeat-n.

Current workaround:

$ npm install --save https://github.com/connorbode/angular-repeat-n#v0.1.5

Can not use {{$index}} with ng-attr

i"m receiving TypeError: t.removeAttribute is not a function error from this code:

<div class="entry__row" ng-repeat-n="entryRows" ng-attr-data-index={{$index}}>
...
</div>

I'll get no error if I change $index with some other variable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.