My data structures might be hard to understand, but I've had graduate level coursework in data structures and a master's in applied math. Your suggestion regarding another way of structuring the data makes sense, but given your restructuring, I don't yet see confusion regarding data structures in having a list of users and a hash of lists of monologues on a per-user basis.
On Fri, Apr 4, 2014 at 12:24 AM, Luke Kende <[email protected]> wrote: > I have to admit, it's hard to follow what you are trying to do. Have you > spent much time understand Javascript object notation (JSON)? It looks > like the core of your difficulty is understanding effective data structures. > > Also, if you can create a plunker to demonstrate, that makes it easier for > the rest of us to see your issue and provide examples of how we might > approach the task. > > Using ng-repeat is great with arrays, and though it can be used on objects > as well, I'd recommend sticking with arrays. So, based on your original > post (with a little cleaning up), I'd have my data structured like this: > > $scope.data ={ > users = [ > { > 'name': 'Bob', > 'email': '[email protected]', > monologues: [ > { > user_id: '001' , > text: 'Some text for the monologue', > timestamp: '0.0' /./not sure how you are creating a > Date from this - if you need it to be a new Date() then loop through data > and do it before binding to scope > }, > { ... more objects matching structure above... } > ] > } > ] > } > > <div ng-controller='OutputController'> > > <div ng-repeat='user in data.users'> > > <div ng-repeat='monologue in user. monologues'> > > <span class='text' ng-bind='monologue.text'></span> > > <span class='timestamp' ng-bind='monologue.timestamp'>< > /span> > > </div> > > </div> > > </div> > > > Hope that gives you some direction. > > > On Thursday, April 3, 2014 1:31:09 PM UTC-6, Christos Jonathan Seth > Hayward wrote: > >> To ask a slightly more focused question: >> >> At present my data is being sent as {"monologues": {" >> [email protected]": [["False", 0.0], ["False", 0.0], ["False", 0.0], >> ["False", 0.0], ["False", 0.0], ["False", 0.0], ["False", 0.0], ["False", >> 0.0], >> ...] >> }, "users": ["[email protected]"]} >> >> On SO someone suggested I have something that looks like [{"monologues": >> {... etc etc ...}}]. >> >> Is my data structured appropriately for the repeater? I want to send a >> dictionary containing a list of strings [perhaps email addresses] for a key >> of "users", and a hash mapping strings [perhaps email addresses] to lists >> for "monologues". >> >> Does my approach make sense, and/or can I appropriately modify either my >> repeaters and/or the JSON data so that the page will read a list of email >> addresses, and then look up lists of lists for each email? >> >> >> On Thu, Apr 3, 2014 at 10:56 AM, Christos Jonathan Seth Hayward < >> [email protected]> wrote: >> >>> I have something that should be showing a lot of data that is not >>> showing any data. >>> >>> In my HTML I have: >>> >>> <div ng-controller='OutputController'> >>> >>> <div ng-repeat='user in data.users'> >>> >>> <div ng-repeat='monologue in data.monologues[user]'> >>> >>> <span class='text' ng-bind='monologue.text'></span> >>> >>> <span class='timestamp' ng-bind='new >>> Date(monologue. timestamp).toLocaleString()'></span> >>> >>> </div> >>> >>> </div> >>> >>> >>> In my JavaScript I have: >>> >>> >>> var repeatEr = function(data, status, headers, config) >>> >>> { >>> >>> var interval = 1000; >>> >>> angular.extend($scope, data); >>> >>> >>> In the data being sent to my page I have: >>> >>> >>> {"monologues": {"[email protected]": [["False", 0.0], ["False", 0.0], >>> ["False", 0.0], ["False", 0.0], ["False", 0.0], ["False", 0.0], ["False", >>> 0.0], ["False", 0.0], ... }, "users": ["[email protected]"]} >>> >>> >>> What is happening is that it is displaying empty results. >>> >>> >>> What I intend for it to do is to pull the Ajax data it is pulling, and then >>> display the text ("False" here) and timestamps in successive DIV's. >>> >>> >>> Given the data as I have it, what should I be doing with the repeaters so >>> that it is displaying results accordingly? >>> >>> --Or-- >>> >>> Given the repeaters I have, what should I be populating as data so that the >>> repeaters will have what they need? >>> >>> >>> Thanks, >>> >>> >>> -- >>> [image: Christos Jonathan Seth Hayward] <http://jonathanscorner.com/> >>> Christos Jonathan Seth Hayward, an Orthodox Christian author. >>> >>> Amazon / Kindle <http://amazon.com/author/cjshayward> * *Author >>> <http://cjshayward.com/>* * Author Bio<http://jonathanscorner.com/author/> >>> * *Email* * Facebook<http://www.facebook.com/christos.jonathan.hayward> >>> * Fan Page <http://fan.cjshayward.com/> * Google >>> Plus<http://jonathanscorner.com/plus> >>> * LinkedIn <http://www.linkedin.com/in/jonathanhayward> * *Professional >>> <http://jonathanhayward.com/>* * Twitter<http://twitter.com/JonathansCorner> >>> * *Web <http://jonathanscorner.com/>* * What's >>> New?<http://jonathanscorner.com/> >>> If you read just *one* of my books, you'll want *The Best of Jonathan's >>> Corner <http://www.amazon.com/dp/1478219912>*. >>> >> >> >> >> -- >> [image: Christos Jonathan Seth Hayward] <http://jonathanscorner.com/> >> Christos Jonathan Seth Hayward, an Orthodox Christian author. >> >> Amazon / Kindle <http://amazon.com/author/cjshayward> * *Author >> <http://cjshayward.com/>* * Author Bio<http://jonathanscorner.com/author/> >> * *Email* * Facebook <http://www.facebook.com/christos.jonathan.hayward> >> * Fan Page <http://fan.cjshayward.com/> * Google >> Plus<http://jonathanscorner.com/plus> >> * LinkedIn <http://www.linkedin.com/in/jonathanhayward> * *Professional >> <http://jonathanhayward.com/>* * Twitter<http://twitter.com/JonathansCorner> >> * *Web <http://jonathanscorner.com/>* * What's >> New?<http://jonathanscorner.com/> >> If you read just *one* of my books, you'll want *The Best of Jonathan's >> Corner <http://www.amazon.com/dp/1478219912>*. >> > -- > You received this message because you are subscribed to the Google Groups > "AngularJS" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/angular. > For more options, visit https://groups.google.com/d/optout. > -- [image: Christos Jonathan Seth Hayward] <http://jonathanscorner.com/> Christos Jonathan Seth Hayward, an Orthodox Christian author. Amazon / Kindle <http://amazon.com/author/cjshayward> * *Author <http://cjshayward.com/>* * Author Bio <http://jonathanscorner.com/author/> * *Email <[email protected]>* * Facebook<http://www.facebook.com/christos.jonathan.hayward> * Fan Page <http://fan.cjshayward.com/> * Google Plus<http://jonathanscorner.com/plus> * LinkedIn <http://www.linkedin.com/in/jonathanhayward> * *Professional <http://jonathanhayward.com/>* * Twitter<http://twitter.com/JonathansCorner> * *Web <http://jonathanscorner.com/>* * What's New?<http://jonathanscorner.com/> If you read just *one* of my books, you'll want *The Best of Jonathan's Corner <http://www.amazon.com/dp/1478219912>*. -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
