angularjs - Angular tracked hashKey not printing -


i'm learning angular book i've reached example doesn't seem working. have this:

<div ng-repeat="note in ctrl.notes track note.id">     {{note.$$hashkey}}     <span class="label"> {{note.label}}</span>     <span class="author" ng-bind="note.done"></span> </div> 

and in controller:

        this.notes = [             {                 id: 1,                 label: 'changed note',                 done: false,                 somerandom: 4242             },             {                 id: 2,                 label: 'second note',                 done: false             },             {                 id: 3,                 label: 'finished third note',                 done: true             }         ]; 

the problem without track note.id prints 3, while adding track note.id, supposed print ids... doesn't print anything, blank , there no errors in console. normal behaviour or doing wrong?

pen: http://codepen.io/vandervals/pen/ejpeml

this normal. $$hashkey angular's way of remembering object relates html elements.

using "track note.id" tells angular "here, use instead. i'm providing collection of notes, , every note have id property , unique." when use tracking expression angular has no need $$hashkey doesn't generate one. book either mis-print or it's out of date.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -