Rich Leach
2017-12-17 18:43:50 UTC
I have a small test app running locally where I setup a simple REST service
that executes a query and returns the results as JSON.
I verified independently that the data returned is, in fact valid JSON.
What I need to do is loop through the JSON to display the results in my
.html template. If I console.log() the results I see my JSON, but I don't
know how exactly I prepare my results from my .ts file and get them
displayed in my .html file. Here are the console.log() results:
1. {COLUMNS: Array(6), DATA: Array(7)}
1. COLUMNS:Array(6)
1. 0:"ID"
2. 1:"ORDERNO"
3. 2:"CREW"
4. 3:"JOBNUMBER"
5. 4:"YARDS"
6. 5:"DELIVERY"
7. length:6
8. __proto__:Array(0)
2. DATA:Array(7)
1. 0:(6) [1, 160, 2, 1702377, 40, "Elm/Turrant Drive"]
2. 1:(6) [2, 44, 3, 1702391, 90, "2099 Steele Street"]
3. 2:(6) [3, 19, 5, 1702294, 30, "Mountain Medical - West Campus"]
4. 3:(6) [4, 66, 6, 1702364, 55, "Estes Regional Dev Center"]
5. 4:(6) [5, 69, 7, 1702272, 170, "Airport Blvd/South lot"]
6. 5:(6) [6, 102, 9, 1702321, 10, "Lakes/NE 44th"]
7. 6:(6) [7, 36, 10, 1702289, 80, "Boulder Tpk/Pecos"]
8. length:7
9. __proto__:Array(0)
3. __proto__:Object
I was looking at some docs on angular.io which talked about creating an
interface, but I've looped over arrays before (that were hard coded, NOT
returned from a http call). This doesn't seem correct but I may be
wrong....
Is there a "best practices" way of doing this sort of thing?
Many thanks,
Rich
that executes a query and returns the results as JSON.
I verified independently that the data returned is, in fact valid JSON.
What I need to do is loop through the JSON to display the results in my
.html template. If I console.log() the results I see my JSON, but I don't
know how exactly I prepare my results from my .ts file and get them
displayed in my .html file. Here are the console.log() results:
1. {COLUMNS: Array(6), DATA: Array(7)}
1. COLUMNS:Array(6)
1. 0:"ID"
2. 1:"ORDERNO"
3. 2:"CREW"
4. 3:"JOBNUMBER"
5. 4:"YARDS"
6. 5:"DELIVERY"
7. length:6
8. __proto__:Array(0)
2. DATA:Array(7)
1. 0:(6) [1, 160, 2, 1702377, 40, "Elm/Turrant Drive"]
2. 1:(6) [2, 44, 3, 1702391, 90, "2099 Steele Street"]
3. 2:(6) [3, 19, 5, 1702294, 30, "Mountain Medical - West Campus"]
4. 3:(6) [4, 66, 6, 1702364, 55, "Estes Regional Dev Center"]
5. 4:(6) [5, 69, 7, 1702272, 170, "Airport Blvd/South lot"]
6. 5:(6) [6, 102, 9, 1702321, 10, "Lakes/NE 44th"]
7. 6:(6) [7, 36, 10, 1702289, 80, "Boulder Tpk/Pecos"]
8. length:7
9. __proto__:Array(0)
3. __proto__:Object
I was looking at some docs on angular.io which talked about creating an
interface, but I've looped over arrays before (that were hard coded, NOT
returned from a http call). This doesn't seem correct but I may be
wrong....
Is there a "best practices" way of doing this sort of thing?
Many thanks,
Rich
--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.