let me take a stab here comparing things to my code.
please add the following, of course fill in the rest of the columns, hope
it is not a big data blob. Also make sure the data types for these keys are
accurate and align to your api (no criss cross)
then instead of
.map(
(response:Response) => {
const data = response.json();
return data;
}
do .map((response: Response) => <Order[]>response.json())
no need for return data. that might be the issue?
export class Order{
ID: number;
ORDERNO: number;
CREW: number;
YARDS: number;
JOBNUMBER: number;
DELIVERY: number;
}
On Tuesday, December 19, 2017 at 9:52:05 AM UTC-8, Rich Leach wrote:
>
> Sure thing, here are my code snippets as requested!
>
>
>
>>> From my html:
>>> <button class="btn btn-primary" (click)="onGet()">Get Concrete
>>> Orders</button>
>>>
>>> <div *ngIf="results">{{results}} //this is where I get the [object
>>> Object] displayed on screen 7 times
>>>
>>> <div *ngFor="let result of results" style="border: thin solid
>>> silver;">
>>> {{result.id}}<br>
>>> {{result.crew}}<br>
>>> {{result.orderno}}<br>
>>> {{result.jobnumber}}<br>
>>> {{result.yards}}<br>
>>> {{result.delivery}}
>>> </div>
>>> </div>
>>>
>>> And my service calling code:
>>> getAllOrders(){
>>> return this.http.get('
>>> http://127.0.0.1:8510/CFC/service.cfc?method=getAllOrders')
>>> .map(
>>> (response:Response) => {
>>> const data = response.json();
>>> return data;
>>> }
>>> );
>>> }
>>>
>>> ... and my component.ts code:
>>> onGet() {
>>> this.dataService.getAllOrders()
>>> .subscribe(
>>> (data: any[]) => console.log(data), //this.results.data
>>> (error) => console.log(error)
>>> );
>>> }
>>>
>>
> and here is the actual console.log(data) result:
>
> 1. (7) [{…}, {…}, {…}, {…}, {…}, {…}, {…}]
> 1. 0:{ID: 1, ORDERNO: 160, CREW: 2, JOBNUMBER: 1702377, YARDS: 40, …
> }
> 2. 1:{ID: 2, ORDERNO: 44, CREW: 3, JOBNUMBER: 1702391, YARDS: 90, …}
> 3. 2:{ID: 3, ORDERNO: 19, CREW: 5, JOBNUMBER: 1702294, YARDS: 30, …}
> 4. 3:{ID: 4, ORDERNO: 66, CREW: 6, JOBNUMBER: 1702364, YARDS: 55, …}
> 5. 4:{ID: 5, ORDERNO: 69, CREW: 7, JOBNUMBER: 1702272, YARDS: 170, …
> }
> 6. 5:{ID: 6, ORDERNO: 102, CREW: 9, JOBNUMBER: 1702321, YARDS: 10, …
> }
> 7. 6:{ID: 7, ORDERNO: 36, CREW: 10, JOBNUMBER: 1702289, YARDS: 80, …
> }
> 8. length:7
> 9.
>
> Thanks for your help,
>
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.