How to do paging in AngularJS?

Angular UI Bootstrap – Pagination Directive Check out UI Bootstrap‘s pagination directive. I ended up using it rather than what is posted here as it has enough features for my current use and has a thorough test spec to accompany it. View <!– table here –> <pagination ng-model=”currentPage” total-items=”todos.length” max-size=”maxSize” boundary-links=”true”> </pagination> <!– items/page select … Read more

Angular ng-repeat Error “Duplicates in a repeater are not allowed.”

The solution is actually described here: http://www.anujgakhar.com/2013/06/15/duplicates-in-a-repeater-are-not-allowed-in-angularjs/ AngularJS does not allow duplicates in a ng-repeat directive. This means if you are trying to do the following, you will get an error. // This code throws the error “Duplicates in a repeater are not allowed. // Repeater: row in [1,1,1] key: number:1″ <div ng-repeat=”row in [1,1,1]”> … Read more

angularjs 1.6.0 (latest now) routes not working

Simply use hashbang #! in the href: <a href=”#!/add-quote”>Add Quote</a> Due to aa077e8, the default hash-prefix used for $location hash-bang URLs has changed from the empty string (”) to the bang (‘!’). If you actually want to have no hash-prefix, then you can restore the previous behavior by adding a configuration block to your application: … Read more

AngularJS performs an OPTIONS HTTP request for a cross-origin resource

OPTIONS request are by no means an AngularJS bug, this is how Cross-Origin Resource Sharing standard mandates browsers to behave. Please refer to this document: https://developer.mozilla.org/en-US/docs/HTTP_access_control, where in the “Overview” section it says: The Cross-Origin Resource Sharing standard works by adding new HTTP headers that allow servers to describe the set of origins that are … Read more

$location / switching between html5 and hashbang mode / link rewriting

The documentation is not very clear about AngularJS routing. It talks about Hashbang and HTML5 mode. In fact, AngularJS routing operates in three modes: Hashbang Mode HTML5 Mode Hashbang in HTML5 Mode For each mode there is a a respective LocationUrl class (LocationHashbangUrl, LocationUrl and LocationHashbangInHTML5Url). In order to simulate URL rewriting you must actually … Read more